Ruby-prof's memory profiling Vs. my app


#1

I’ve been using ruby-prof’s memory profiling mode to try to reduce the
memory usage of an app, with ruby enterprise edition and rails 2.2.2. I
setup a profiling test (as recommended in the ruby-prof docs) for a
single action, and after my refactoring ruby-prof said I had cut memory
usage by 1/3 and object allocations by 1/2.

After this, I setup a script to hit that action repeatedly with the same
parameters and measure the amount of memory used by the mongrel process,
once for my refactored code and once for point I branched from. This
script tells me that I’ve actually made the memory usage worse by about
10-20%.

Has anyone run into a discrepancy like this before?