summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-15 23:06:32 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-15 23:06:32 +0000
commitf5c2e89cd44a27b2391f94cb1b9cad74b9be692d (patch)
tree9702f300afa9da64216b85f82f7eab0a34d1e184 /gc.c
parent356644685e5f27df9c2dfdacfdff4cb1d7383136 (diff)
gc.c (objspace_xcalloc): fix GC accounting
This hopefully works on all platforms with malloc_usable_size. This may also trigger bugs in places which did not expect GC, too; so maybe some existing code will need RB_GC_GUARD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 3b373bef07..95e13c692c 100644
--- a/gc.c
+++ b/gc.c
@@ -6231,6 +6231,8 @@ objspace_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
size = objspace_malloc_prepare(objspace, size);
TRY_WITH_GC(mem = calloc(1, size));
+ size = objspace_malloc_size(objspace, mem, size);
+ objspace_malloc_increase(objspace, mem, size, 0, MEMOP_TYPE_MALLOC);
return objspace_malloc_fixup(objspace, mem, size);
}