[前][次][番号順一覧][スレッド一覧]

ruby-changes:46216

From: rhe <ko1@a...>
Date: Thu, 13 Apr 2017 15:43:23 +0900 (JST)
Subject: [ruby-changes:46216] rhe:r58332 (trunk): array.c: report correct memsize for shared root arrays

rhe	2017-04-13 15:43:17 +0900 (Thu, 13 Apr 2017)

  New Revision: 58332

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58332

  Log:
    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.

  Modified files:
    trunk/array.c
Index: array.c
===================================================================
--- array.c	(revision 58331)
+++ array.c	(revision 58332)
@@ -555,7 +555,7 @@ RUBY_FUNC_EXPORTED size_t https://github.com/ruby/ruby/blob/trunk/array.c#L555
 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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]