diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | class.c | 3 | ||||
-rw-r--r-- | gc.c | 1 |
3 files changed, 10 insertions, 2 deletions
@@ -1,3 +1,11 @@ +Tue Oct 4 21:10:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * class.c (class_alloc): allocate extra memory after containing + object setup to get rid of rare-but-potential memory leak. + + * gc.c (gc_mark_children): skip marking extended members if ptr is + NULL. + Tue Oct 4 16:17:50 2011 NARUSE, Yui <naruse@ruby-lang.org> * lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set. @@ -49,10 +49,9 @@ static ID id_attached; static VALUE class_alloc(VALUE flags, VALUE klass) { - rb_classext_t *ext = ALLOC(rb_classext_t); NEWOBJ(obj, struct RClass); OBJSETUP(obj, klass, flags); - obj->ptr = ext; + obj->ptr = ALLOC(rb_classext_t); RCLASS_IV_TBL(obj) = 0; RCLASS_CONST_TBL(obj) = 0; RCLASS_M_TBL(obj) = 0; @@ -1824,6 +1824,7 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr, int lev) case T_CLASS: case T_MODULE: mark_m_tbl(objspace, RCLASS_M_TBL(obj), lev); + if (!RCLASS_EXT(obj)) break; mark_tbl(objspace, RCLASS_IV_TBL(obj), lev); mark_const_tbl(objspace, RCLASS_CONST_TBL(obj), lev); ptr = RCLASS_SUPER(obj); |