diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-27 18:14:28 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-27 18:14:28 +0000 |
commit | 30dbed383786362eaf70ad584a8b382a12b68fef (patch) | |
tree | bc0325c9f735daec0d64d6f3f8ffcb27380352ee /ext/objspace/objspace.c | |
parent | b01c4ddfce5faa7e0bb982a41319c7e44141c5e3 (diff) | |
download | ruby-30dbed383786362eaf70ad584a8b382a12b68fef.tar.gz |
* ext/objspace/gc_hook.c, ext/objspace/objspace.c: add new methods to
hook GC invocation.
* ObjectSpace.after_gc_start_hook=(proc)
* ObjectSpace.after_gc_end_hook=(proc)
Note that hooks are not kicked immediately. Procs are kicked
at postponed_job.
This feature is a sample of new internal event and
rb_postponed_job API.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/objspace/objspace.c')
-rw-r--r-- | ext/objspace/objspace.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index a077a1e4e0..ae298fc3e1 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -780,6 +780,7 @@ reachable_objects_from(VALUE self, VALUE obj) } void Init_object_tracing(VALUE rb_mObjSpace); +void Init_gc_hook(VALUE rb_mObjSpace); /* objspace library extends ObjectSpace module and add several * methods to get internal statistic information about @@ -811,4 +812,5 @@ Init_objspace(void) rb_define_method(rb_mInternalObjectWrapper, "internal_object_id", iow_internal_object_id, 0); Init_object_tracing(rb_mObjSpace); + Init_gc_hook(rb_mObjSpace); } |