Profiling Ruby’s Memory Allocation with TCmalloc

How does memory allocation work in Ruby? Ruby gets memory in chunks, called pages, new objects are saved here. Then… When these pages are full, more memory is needed. Ruby requests more memory from the operating system with the malloc function. This malloc function is part of the operating system itself, but there are alternative … Read more

How to Write a Ruby C Extension (Step-by-Step)

Writing a C extension allows you to interact with Ruby from C. You may want to this if there is a particular important method you would like to optimize with the speed of C, or if you would like to create an interface between a C library and Ruby. An alternative would be to use … Read more

What Are Ruby Symbols & How Do They Work?

A symbol looks like this: Some people confuse symbols with variables, but they have nothing to do with variables… …a symbol is a lot more like a string. So what are the differences between Ruby symbols & strings? Strings are used to work with data. Symbols are identifiers. That’s the main difference: Symbols are not … Read more

Functional Programming In Ruby (Complete Guide)

Maybe you just heard about functional programming & have some questions. Like… What is functional programming exactly? How does it compare to object-oriented programming? Should you be using functional programming in Ruby? Let me answer these questions for you so you can get a better idea of how this works. What Is Functional Programming? It’s … Read more