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

gc.c: memsize of T_NODE

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-08-15 03:00:31 +00:00
parent e5c9e56893
commit 85691b9578

16
gc.c
View file

@ -2601,18 +2601,24 @@ obj_memsize_of(VALUE obj, int use_tdata)
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 &&