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

* 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:
matz 2001-01-23 09:55:10 +00:00
parent 2455b077df
commit e111bdb9d3
2 changed files with 27 additions and 11 deletions

View file

@ -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>
* gc.c (os_live_obj): do not list terminated object.

33
gc.c
View file

@ -717,7 +717,7 @@ gc_sweep()
during_gc = 0;
/* clear finalization list */
if (need_call_final && final_list) {
if (final_list) {
RVALUE *tmp;
if (rb_prohibit_interrupt || ruby_in_compile) {
@ -1213,9 +1213,9 @@ run_final(obj)
args[0] = RARRAY(finalizers)->ptr[i];
rb_protect(run_single_final, (VALUE)args, &status);
}
if (finalizer_table && st_lookup(finalizer_table, obj, &table)) {
st_delete(finalizer_table, &obj, 0);
if (finalizer_table && st_delete(finalizer_table, &obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) {
printf("n finals=>%d\n", finalizer_table->num_entries);
args[0] = RARRAY(table)->ptr[i];
rb_protect(run_single_final, (VALUE)args, &status);
}
@ -1229,15 +1229,26 @@ rb_gc_call_finalizer_at_exit()
int i;
/* run finalizers */
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;
run_final((VALUE)p);
if (need_call_final) {
if (deferred_final_list) {
p = deferred_final_list;
while (p) {
RVALUE *tmp = p;
p = p->as.free.next;
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 */