Project

General

Profile

Bug #9026

[PATCH] Add ObjectSpace.heap_dump to objspace.so

Added by Aman Gupta almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
ruby -v:
ruby 2.1.0dev (2013-10-16 trunk 43297) [x86_64-darwin12.4.1]
[ruby-core:57893]

Associated revisions

Revision 43585
Added by Aman Gupta over 2 years ago

  • ext/objspace/object_tracing.c: Add experimental methods to dump objectspace as json: ObjectSpace.dump_all and ObjectSpace.dump(obj). These methods are useful for debugging reference leaks and memory growth in large ruby applications. [Bug #9026] [Fixes GH-423]

Revision 43585
Added by Aman Gupta over 2 years ago

  • ext/objspace/object_tracing.c: Add experimental methods to dump objectspace as json: ObjectSpace.dump_all and ObjectSpace.dump(obj). These methods are useful for debugging reference leaks and memory growth in large ruby applications. [Bug #9026] [Fixes GH-423]

Revision 43585
Added by Aman Gupta over 2 years ago

  • ext/objspace/object_tracing.c: Add experimental methods to dump objectspace as json: ObjectSpace.dump_all and ObjectSpace.dump(obj). These methods are useful for debugging reference leaks and memory growth in large ruby applications. [Bug #9026] [Fixes GH-423]

History

#1 [ruby-core:57905] Updated by Aman Gupta almost 3 years ago

Based on feedback from ko1-san, I have modified the ruby signatures as follows:

  • call-seq:
  • ObjectSpace.dump(obj[, output: :string]) # => "{...}"
  • ObjectSpace.dump(obj, output: :file) # => "/tmp/rubyobj000000"
  • ObjectSpace.dump(obj, output: :stdout) # => nil

  • call-seq:

  • ObjectSpace.dump_all([output: :file]) # => "/tmp/rubyheap000000"

  • ObjectSpace.dump_all(output: :stdout) # => nil

  • ObjectSpace.dump_all(output: :string) # => "{...}\n{...}\n..."

If anyone has opinions on these APIs, I'd love to hear them.

#2 [ruby-core:58174] Updated by Alexander Kahn over 2 years ago

I think it could be helpful to be able to specify the filename that the dump should be written to, or at least the directory.

#3 [ruby-core:58235] Updated by Aman Gupta over 2 years ago

You can use something like this: FileUtils.mv(ObjectSpace.dump_all, "mydumpfile.json")

#4 Updated by Aman Gupta over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r43585.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/objspace/object_tracing.c: Add experimental methods to dump objectspace as json: ObjectSpace.dump_all and ObjectSpace.dump(obj). These methods are useful for debugging reference leaks and memory growth in large ruby applications. [Bug #9026] [Fixes GH-423]

Also available in: Atom PDF