diff options
-rw-r--r-- | ext/objspace/lib/objspace.rb | 65 |
1 files changed, 60 insertions, 5 deletions
@@ -6,6 +6,7 @@ module ObjectSpace class << self private :_dump private :_dump_all end module_function @@ -53,23 +54,38 @@ module ObjectSpace # # 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. - def dump_all(output: :file, full: false, since: nil) out = case output when :file, nil require 'tempfile' @@ -84,7 +100,46 @@ module ObjectSpace raise ArgumentError, "wrong output option: #{output.inspect}" end - ret = _dump_all(out, full, since) return nil if output == :stdout ret end |