1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
normal 2014-03-15 23:06:32 +00:00
parent 356644685e
commit f5c2e89cd4
2 changed files with 6 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Sun Mar 16 08:05:06 2014 Eric Wong <e@80x24.org>
* gc.c (objspace_xcalloc): fix GC accounting
Sun Mar 16 06:33:35 2014 NARUSE, Yui <naruse@ruby-lang.org>
* addr2line.c (fill_lines): return address is just after calling

2
gc.c
View file

@ -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);
}