diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-24 06:46:44 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-24 06:46:44 +0000 |
commit | 9e1624cfe8880fc018e34327c77669f2f4e5b100 (patch) | |
tree | 1f1ec71af916b8b0472ab9193d6d87b5bd8f41ce /gc.c | |
parent | 144e06700705a3f067582682567bc77b429c4fca (diff) | |
download | ruby-9e1624cfe8880fc018e34327c77669f2f4e5b100.tar.gz |
Add debug counters.
* debug_counter.h: add the following counters to measure object types.
obj_free: freed count
obj_str_ptr: freed count of Strings they have extra buff.
obj_str_embed: freed count of Strings they don't have extra buff.
obj_str_shared: freed count of Strings they have shared extra buff.
obj_str_nofree: freed count of Strings they are marked as nofree.
obj_str_fstr: freed count of Strings they are marked as fstr.
obj_ary_ptr: freed count of Arrays they have extra buff.
obj_ary_embed: freed count of Arrays they don't have extra buff.
obj_obj_ptr: freed count of Objects (T_OBJECT) they have extra buff.
obj_obj_embed: freed count of Objects they don't have extra buff.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -33,6 +33,7 @@ #include <setjmp.h> #include <sys/types.h> #include "ruby_assert.h" +#include "debug_counter.h" #undef rb_data_object_wrap @@ -2103,6 +2104,8 @@ make_io_zombie(rb_objspace_t *objspace, VALUE obj) static int obj_free(rb_objspace_t *objspace, VALUE obj) { + RB_DEBUG_COUNTER_INC(obj_free); + gc_event_hook(objspace, RUBY_INTERNAL_EVENT_FREEOBJ, obj); switch (BUILTIN_TYPE(obj)) { @@ -2137,6 +2140,10 @@ obj_free(rb_objspace_t *objspace, VALUE obj) if (!(RANY(obj)->as.basic.flags & ROBJECT_EMBED) && RANY(obj)->as.object.as.heap.ivptr) { xfree(RANY(obj)->as.object.as.heap.ivptr); + RB_DEBUG_COUNTER_INC(obj_obj_ptr); + } + else { + RB_DEBUG_COUNTER_INC(obj_obj_embed); } break; case T_MODULE: |