Hacker Newsnew | past | comments | ask | show | jobs | submit | dmitrytsepelev's commentslogin

Memory bloat in Ruby happens when someone loads a lot of data to the memory. Ruby Virtual Machine does not return most of the allocated memory to the operating system even after data is collected as a garbage. It’s not a big deal for local development or console programs, but if you have a bloat in the big Rails app it might cost you a lot of money.

It is quite easy to find a fix memory bloat when it happens, but can we prevent it?


Java does use string interning for constants. It can help in any case when you have a lot of instances of the same string (and when you need to compare that strings)


Thank you for catching that! Not sure where my eyes were, feels like it's a remnant of another version of the sentence. Removed


No problem! Same thing happens to me, where my eyes begin to gloss over things I've written (because I know what I mean to say).

Thanks for the submission!


BTW, a good technique for catching those kinds of mistakes is to read the piece out loud. Engaging more of your nervous system makes the visual elision easier to detect.


In this case the row size can become huge. Also, how to make sure it's consistent? (I mean foreign keys/unique indexes/etc)


i was mostly talking about reading side, not mutation side.


Great post! By the way, the reason why ar_lazy_preload exists is that neither me nor anyone else around me heard about goldiloader at the moment when ar_lazy_preload was created


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: