diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-21 21:21:23 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-21 21:21:23 +0000 |
commit | b0200a5e367f24edf653703fc0bcb01dae6b1e07 (patch) | |
tree | 9a58fbc9960d7b654c7b2b934b9618eb1e6dde24 /array.c | |
parent | af71ee55efb20b7f70a91a3e20cc582098aef869 (diff) |
array.c: use ruby_sized_free and SIZED_REALLOC_N
Part of the plan to reduce dependencies on malloc_usable_size
which costs us speed: https://bugs.ruby-lang.org/issues/10238
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -230,7 +230,7 @@ ary_resize_capa(VALUE ary, long capacity) MEMCPY((VALUE *)RARRAY(ary)->as.ary, ptr, VALUE, len); FL_SET_EMBED(ary); ARY_SET_LEN(ary, len); - ruby_xfree((VALUE *)ptr); + ruby_sized_xfree((VALUE *)ptr, RARRAY(ary)->as.heap.aux.capa); } } } @@ -243,7 +243,7 @@ ary_shrink_capa(VALUE ary) assert(!ARY_SHARED_P(ary)); assert(old_capa >= capacity); if (old_capa > capacity) - REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, capacity); + SIZED_REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, capacity, old_capa); } static void |