I'm investigating memory usage in a Ruby on Rails 6 app. I wrote the following code around an initializer:
if !ENV["MEMPROFILE"].blank?
require 'memory_profiler'
MemoryProfiler.start
end
# My initializer
if !ENV["MEMPROFILE"].blank?
puts "MEMPROFILE"
report = MemoryProfiler.stop
report.pretty_print
end
Normally, the process uses about 1GB and with the profiler, it uses about 6GB, so it's clearly doing something, but the results printed show NO DATA. The # My initializer section above is definitely executing and doing a lot (I can see the print statements). Any thoughts?
MEMPROFILE
Total allocated: 0 bytes (0 objects)
Total retained: 0 bytes (0 objects)
allocated memory by gem
-----------------------------------
NO DATA
allocated memory by file
-----------------------------------
NO DATA
allocated memory by location
-----------------------------------
NO DATA
allocated memory by class
-----------------------------------
NO DATA
allocated objects by gem
-----------------------------------
NO DATA
allocated objects by file
-----------------------------------
NO DATA
allocated objects by location
-----------------------------------
NO DATA
allocated objects by class
-----------------------------------
NO DATA
retained memory by gem
-----------------------------------
NO DATA
retained memory by file
-----------------------------------
NO DATA
retained memory by location
-----------------------------------
NO DATA
retained memory by class
-----------------------------------
NO DATA
retained objects by gem
-----------------------------------
NO DATA
retained objects by file
NO DATA
retained objects by location
-----------------------------------
NO DATA
retained objects by class
-----------------------------------
NO DATA
Ruby version:
$ ruby -v
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
Running on Linux Fedora 37 x64
I'm investigating memory usage in a Ruby on Rails 6 app. I wrote the following code around an initializer:
Normally, the process uses about 1GB and with the profiler, it uses about 6GB, so it's clearly doing something, but the results printed show
NO DATA. The# My initializersection above is definitely executing and doing a lot (I can see the print statements). Any thoughts?Ruby version:
Running on Linux Fedora 37 x64