summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-12 19:44:48 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-12 19:44:48 +0000
commit7b614a53dd50508410c48113dce87abfc003df6b (patch)
treeeed417a3a293cee1d3da10de4e76c1c5d2991126
parenta7198a3c739f7c09f21f69df8611ae47780e3a68 (diff)
* 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
-rw-r--r--ChangeLog4
-rw-r--r--ext/objspace/objspace.c15
2 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 98f6c98..f0e6b89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jun 13 04:42:24 2011 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (total_i): fix to skip no ruby objects.
+
Mon Jun 13 03:07:38 2011 NARUSE, Yui <naruse@ruby-lang.org>
* test/benchmark/test_benchmark.rb (capture_output):
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index 8e8b29f..3434a0a 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);
+ }
}
}
}