Skip to content

Commit

Permalink
array.c: report correct memsize for shared root arrays
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rhenium committed Apr 13, 2017
1 parent 55d0da5 commit 4e85fee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4e85fee

Please sign in to comment.