ruby-changes:46559
From: nobu <ko1@a...>
Date: Fri, 12 May 2017 16:48:12 +0900 (JST)
Subject: [ruby-changes:46559] nobu:r58673 (trunk): gc.c: objspace_malloc_fixup
nobu 2017-05-12 16:48:05 +0900 (Fri, 12 May 2017) New Revision: 58673 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58673 Log: gc.c: objspace_malloc_fixup * gc.c (objspace_malloc_fixup): include allocated size managements. Modified files: trunk/gc.c Index: gc.c =================================================================== --- gc.c (revision 58672) +++ gc.c (revision 58673) @@ -7818,6 +7818,9 @@ objspace_malloc_prepare(rb_objspace_t *o https://github.com/ruby/ruby/blob/trunk/gc.c#L7818 static inline void * objspace_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size) { + size = objspace_malloc_size(objspace, mem, size); + objspace_malloc_increase(objspace, mem, size, 0, MEMOP_TYPE_MALLOC); + #if CALC_EXACT_MALLOC_SIZE ((size_t *)mem)[0] = size; mem = (size_t *)mem + 1; @@ -7845,8 +7848,6 @@ objspace_xmalloc0(rb_objspace_t *objspac https://github.com/ruby/ruby/blob/trunk/gc.c#L7848 size = objspace_malloc_prepare(objspace, size); TRY_WITH_GC(mem = malloc(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); } @@ -7962,8 +7963,6 @@ objspace_xcalloc(rb_objspace_t *objspace https://github.com/ruby/ruby/blob/trunk/gc.c#L7963 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/