From 9e1624cfe8880fc018e34327c77669f2f4e5b100 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 24 May 2017 06:46:44 +0000 Subject: 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 --- array.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'array.c') diff --git a/array.c b/array.c index cff6d69ad3..0775e82999 100644 --- a/array.c +++ b/array.c @@ -16,6 +16,7 @@ #include "ruby/st.h" #include "probes.h" #include "id.h" +#include "debug_counter.h" #ifndef ARRAY_DEBUG # define NDEBUG @@ -553,8 +554,12 @@ void rb_ary_free(VALUE ary) { if (ARY_OWNS_HEAP_P(ary)) { + RB_DEBUG_COUNTER_INC(obj_ary_ptr); ruby_sized_xfree((void *)ARY_HEAP_PTR(ary), ARY_HEAP_SIZE(ary)); } + else { + RB_DEBUG_COUNTER_INC(obj_ary_embed); + } } RUBY_FUNC_EXPORTED size_t -- cgit v1.2.3