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

array.c: report correct memsize for shared root arrays

For a shared array root, struct RArray::as.heap.aux.capa stores the
number of Arrays holding reference to that T_ARRAY instead of the actual
heap-allocated capacity. Use ARY_CAPA() macro which handles this
appropriately.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
rhe 2017-04-13 06:43:17 +00:00
parent 55d0da5105
commit 4e85feed33

View file

@ -555,7 +555,7 @@ RUBY_FUNC_EXPORTED size_t
rb_ary_memsize(VALUE ary)
{
if (ARY_OWNS_HEAP_P(ary)) {
return RARRAY(ary)->as.heap.aux.capa * sizeof(VALUE);
return ARY_CAPA(ary) * sizeof(VALUE);
}
else {
return 0;