diff options
| author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-27 13:08:02 +0000 |
|---|---|---|
| committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-27 13:08:02 +0000 |
| commit | 1e44ac228669edf4be57f91a7fca43d07a375fce (patch) | |
| tree | f4f9baf20df60ad97411d55a3aca7ac240560ec7 /gc.c | |
| parent | a5511af685cfbc4047b2a273edb96cfa364e90a1 (diff) | |
| download | ruby-1e44ac228669edf4be57f91a7fca43d07a375fce.tar.gz ruby-1e44ac228669edf4be57f91a7fca43d07a375fce.tar.xz ruby-1e44ac228669edf4be57f91a7fca43d07a375fce.zip | |
* gc.c (gc_mark_children, obj_free): T_DEFERRED should not be appear.
* gc.c (gc_sweep, finalize_list): fix to decrement heap_slot#limit
after executing finalizer.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
| -rw-r--r-- | gc.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -1315,9 +1315,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr, int lev) } break; - case T_DEFERRED: - break; - default: rb_bug("rb_gc_mark(): unknown data type 0x%lx(%p) %s", BUILTIN_TYPE(obj), obj, @@ -1345,6 +1342,10 @@ finalize_list(rb_objspace_t *objspace, RVALUE *p) if (!FL_TEST(p, FL_SINGLETON)) { /* not freeing page */ add_freelist(objspace, p); } + else { + struct heaps_slot *slot = (struct heaps_slot *)RDATA(p)->dmark; + slot->limit--; + } p = tmp; } } @@ -1439,11 +1440,15 @@ gc_sweep(rb_objspace_t *objspace) } if (n == heaps[i].limit && freed > do_heap_free) { RVALUE *pp; + int f_count = 0; - heaps[i].limit = 0; for (pp = final_list; pp != final; pp = pp->as.free.next) { - p->as.free.flags |= FL_SINGLETON; /* freeing page mark */ + f_count++; + RDATA(pp)->dmark = (void *)&heaps[i]; + pp->as.free.flags |= FL_SINGLETON; /* freeing page mark */ } + heaps[i].limit = f_count; + freelist = free; /* cancel this page from freelist */ } else { @@ -1605,9 +1610,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) } break; - case T_DEFERRED: - break; - default: rb_bug("gc_sweep(): unknown data type 0x%lx(%p)", BUILTIN_TYPE(obj), (void*)obj); |
