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

ruby-changes:35106

From: nobu <ko1@a...>
Date: Fri, 15 Aug 2014 12:00:35 +0900 (JST)
Subject: [ruby-changes:35106] nobu:r47188 (trunk): gc.c: memsize of T_NODE

nobu	2014-08-15 12:00:31 +0900 (Fri, 15 Aug 2014)

  New Revision: 47188

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

  Log:
    gc.c: memsize of T_NODE
    
    * gc.c (obj_memsize_of): fix size of T_NODE and comments.

  Modified files:
    trunk/gc.c
Index: gc.c
===================================================================
--- gc.c	(revision 47187)
+++ gc.c	(revision 47188)
@@ -2601,18 +2601,24 @@ obj_memsize_of(VALUE obj, int use_tdata) https://github.com/ruby/ruby/blob/trunk/gc.c#L2601
 	    size += BIGNUM_LEN(obj) * sizeof(BDIGIT);
 	}
 	break;
+
       case T_NODE:
 	switch (nd_type(obj)) {
 	  case NODE_SCOPE:
-	    if (RNODE(obj)->u1.tbl) {
-		/* TODO: xfree(RANY(obj)->as.node.u1.tbl); */
+	    if (RNODE(obj)->nd_tbl) {
+		size += (RNODE(obj)->nd_tbl[0]+1) * sizeof(*RNODE(obj)->nd_tbl);
+	    }
+	    break;
+	  case NODE_ARGS:
+	    if (RNODE(obj)->nd_ainfo) {
+		size += sizeof(*RNODE(obj)->nd_ainfo);
 	    }
 	    break;
 	  case NODE_ALLOCA:
-	    /* TODO: xfree(RANY(obj)->as.node.u1.node); */
-	    ;
+	    size += RNODE(obj)->nd_cnt * sizeof(VALUE);
+	    break;
 	}
-	break;			/* no need to free iv_tbl */
+	break;
 
       case T_STRUCT:
 	if ((RBASIC(obj)->flags & RSTRUCT_EMBED_LEN_MASK) == 0 &&

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

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