summaryrefslogtreecommitdiff
path: root/ext/objspace
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-08 00:18:42 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-08 00:18:42 +0000
commit1c5b309211c8d41b2624766fdeb60cc5fa3faf94 (patch)
tree40e8d070a7035985a6e5642ff2fd3d3df5ae4eea /ext/objspace
parent5b1065f3fee2a3cb0095a28a5bedaa3f74f09a5b (diff)
* ext/objspace/objspace.c (iow_size): return size of internal object
for ObjectSpace.memsize_of(). * test/objspace/test_objspace.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/objspace')
-rw-r--r--ext/objspace/objspace.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index 1889f11382..5d585d69a1 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -639,9 +639,16 @@ iow_mark(void *ptr)
rb_gc_mark((VALUE)ptr);
}
+static size_t
+iow_size(const void *ptr)
+{
+ VALUE obj = (VALUE)ptr;
+ return memsize_of(obj);
+}
+
static const rb_data_type_t iow_data_type = {
"ObjectSpace::InternalObjectWrapper",
- {iow_mark, 0, 0,},
+ {iow_mark, 0, iow_size,},
};
static VALUE rb_mInternalObjectWrapper;