Reducing memory usage in Ruby

Reducing memory usage in Ruby
Average rating: 0
(0 votes)

During compilation, some parts of your code are converted to Ruby objects and then the addresses for those objects are embedded in the bytecode. We do obviously need a strategy for reducing memory usage in Ruby! 

When your Ruby code is compiled, it turns into instruction sequence objects, and those objects are Ruby objects. Typically you don’t interact with these Ruby objects, but they are there. These objects store bytecode for your Ruby program, any literals in your code, and some other miscellaneous information about the code that was compiled.

The strategy shown in this material helps to save approximately 3% memory on a basic Rails application set to production mode.

Rate this article, if you like it

Thanks! You’ve rated this material!

Got a project? Let's discuss it!

*By submitting this form you agree with our Privacy Policy.

Mailing & Legal Address

Syndicode Inc. 340 S Lemon Ave #3299, Walnut CA, 91789, USA

Visiting & Headquarters address
Kyiv Sofiivska 1/2a, 01001, Kyiv, Ukraine
Dnipro Hlinky 2, of. 1003, 49000, Dnipro, Ukraine
Email info@syndicode.com
Phone (+1) 9035021111