diff options
author | tmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-08 17:06:55 +0000 |
---|---|---|
committer | tmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-08 17:06:55 +0000 |
commit | d0d6e2ecfaf1cbf0b6c6095a1118ad375b2a0659 (patch) | |
tree | a98d7eaadb59e2bc67dba9b4cb2eb5210f194532 /ext/objspace/object_tracing.c | |
parent | 6edaaf15e3fdcff35d3ec901a01969d575036ba9 (diff) |
* 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] [ruby-core:57893] [Fixes GH-423]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/objspace/object_tracing.c')
-rw-r--r-- | ext/objspace/object_tracing.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c index 5fe1d757e5..b8fa3edf4d 100644 --- a/ext/objspace/object_tracing.c +++ b/ext/objspace/object_tracing.c @@ -15,6 +15,7 @@ #include "ruby/ruby.h" #include "ruby/debug.h" +#include "objspace.h" size_t rb_gc_count(void); /* from gc.c */ @@ -28,20 +29,6 @@ struct traceobj_arg { struct traceobj_arg *prev_traceobj_arg; }; -/* all of information don't need marking. */ -struct allocation_info { - int living; - VALUE flags; - VALUE klass; - - /* allocation info */ - const char *path; - unsigned long line; - const char *class_path; - VALUE mid; - size_t generation; -}; - static const char * make_unique_str(st_table *tbl, const char *str, long len) { @@ -341,6 +328,12 @@ lookup_allocation_info(VALUE obj) return NULL; } +struct allocation_info * +objspace_lookup_allocation_info(VALUE obj) +{ + return lookup_allocation_info(obj); +} + /* * call-seq: allocation_sourcefile(object) -> string * |