End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
ObjectSpace#dump_all
# File tmp/rubies/ruby-3.0.5/ext/objspace/lib/objspace.rb, line 72
def dump_all(output: :file, full: false, since: nil)
out = case output
when :file, nil
require 'tempfile'
Tempfile.create(%w(rubyheap .json))
when :stdout
STDOUT
when :string
+''
when IO
output
else
raise ArgumentError, "wrong output option: #{output.inspect}"
end
ret = _dump_all(out, full, since)
return nil if output == :stdout
ret
end
Dump the contents of the ruby heap as JSON.
since must be a non-negative integer or nil.
If since is a positive integer, only objects of that generation and newer generations are dumped. The current generation can be accessed using GC::count.
Objects that were allocated without object allocation tracing enabled are ignored. See ::trace_object_allocations for more information and examples.
If since is omitted or is nil, all objects are dumped.
This method is only expected to work with C Ruby. This is an experimental method and is subject to change. In particular, the function signature and output format are not guaranteed to be compatible in future versions of ruby.