* gc.c (rb_gc_call_finalizer_at_exit): should finalize objects in
deferred_final_list too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2455b077df
commit
e111bdb9d3
@ -1,3 +1,8 @@
|
|||||||
|
Tue Jan 23 18:51:57 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* gc.c (rb_gc_call_finalizer_at_exit): should finalize objects in
|
||||||
|
deferred_final_list too.
|
||||||
|
|
||||||
Tue Jan 23 16:10:12 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Jan 23 16:10:12 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* gc.c (os_live_obj): do not list terminated object.
|
* gc.c (os_live_obj): do not list terminated object.
|
||||||
|
33
gc.c
33
gc.c
@ -717,7 +717,7 @@ gc_sweep()
|
|||||||
during_gc = 0;
|
during_gc = 0;
|
||||||
|
|
||||||
/* clear finalization list */
|
/* clear finalization list */
|
||||||
if (need_call_final && final_list) {
|
if (final_list) {
|
||||||
RVALUE *tmp;
|
RVALUE *tmp;
|
||||||
|
|
||||||
if (rb_prohibit_interrupt || ruby_in_compile) {
|
if (rb_prohibit_interrupt || ruby_in_compile) {
|
||||||
@ -1213,9 +1213,9 @@ run_final(obj)
|
|||||||
args[0] = RARRAY(finalizers)->ptr[i];
|
args[0] = RARRAY(finalizers)->ptr[i];
|
||||||
rb_protect(run_single_final, (VALUE)args, &status);
|
rb_protect(run_single_final, (VALUE)args, &status);
|
||||||
}
|
}
|
||||||
if (finalizer_table && st_lookup(finalizer_table, obj, &table)) {
|
if (finalizer_table && st_delete(finalizer_table, &obj, &table)) {
|
||||||
st_delete(finalizer_table, &obj, 0);
|
|
||||||
for (i=0; i<RARRAY(table)->len; i++) {
|
for (i=0; i<RARRAY(table)->len; i++) {
|
||||||
|
printf("n finals=>%d\n", finalizer_table->num_entries);
|
||||||
args[0] = RARRAY(table)->ptr[i];
|
args[0] = RARRAY(table)->ptr[i];
|
||||||
rb_protect(run_single_final, (VALUE)args, &status);
|
rb_protect(run_single_final, (VALUE)args, &status);
|
||||||
}
|
}
|
||||||
@ -1229,15 +1229,26 @@ rb_gc_call_finalizer_at_exit()
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* run finalizers */
|
/* run finalizers */
|
||||||
for (i = 0; i < heaps_used; i++) {
|
if (need_call_final) {
|
||||||
p = heaps[i]; pend = p + HEAP_SLOTS;
|
if (deferred_final_list) {
|
||||||
while (p < pend) {
|
p = deferred_final_list;
|
||||||
if (FL_TEST(p, FL_FINALIZE)) {
|
while (p) {
|
||||||
FL_UNSET(p, FL_FINALIZE);
|
RVALUE *tmp = p;
|
||||||
p->as.basic.klass = 0;
|
p = p->as.free.next;
|
||||||
run_final((VALUE)p);
|
run_final((VALUE)tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i = 0; i < heaps_used; i++) {
|
||||||
|
p = heaps[i]; pend = p + HEAP_SLOTS;
|
||||||
|
while (p < pend) {
|
||||||
|
if (FL_TEST(p, FL_FINALIZE)) {
|
||||||
|
FL_UNSET(p, FL_FINALIZE);
|
||||||
|
p->as.basic.klass = 0;
|
||||||
|
printf("%p\n", p);
|
||||||
|
run_final((VALUE)p);
|
||||||
|
}
|
||||||
|
p++;
|
||||||
}
|
}
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* run data object's finaliers */
|
/* run data object's finaliers */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user