Measure Memory Yourself with GC#stat and GC::Profiler
You need to make manual measurements to profile memory without RailsExpress patches. We want to measure memory usage and GC statistics, print and collect them, then analyze them. That’s a lot of work, but sometimes it’s our only option. For example, a memory leak might happen in production only. We certainly don’t want to run production inside the profiler—that would slow it down. But we can insert the measurement code instead.
The first thing we want to measure is the current memory usage. As we discussed earlier, it’s less relevant than the memory usage deltas that we saw in ruby-prof, but in production, it’s the only number we can get.
The best way to measure memory is to ask the operating ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access