From 7b614a53dd50508410c48113dce87abfc003df6b Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 12 Jun 2011 19:44:48 +0000 Subject: * ext/objspace/objspace.c (total_i): fix to skip no ruby objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/objspace/objspace.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ext/objspace') diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index 8e8b29f6e9..3434a0ae07 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -185,8 +185,19 @@ total_i(void *vstart, void *vend, size_t stride, void *ptr) for (v = (VALUE)vstart; v != (VALUE)vend; v += stride) { if (RBASIC(v)->flags) { - if (data->klass == 0 || rb_obj_is_kind_of(v, data->klass)) { - data->total += memsize_of(v); + switch (BUILTIN_TYPE(v)) { + case T_NONE: + case T_ICLASS: + case T_NODE: + case T_ZOMBIE: + continue; + case T_CLASS: + if (FL_TEST(v, FL_SINGLETON)) + continue; + default: + if (data->klass == 0 || rb_obj_is_kind_of(v, data->klass)) { + data->total += memsize_of(v); + } } } } -- cgit v1.2.3