diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-07-10 14:21:11 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-07-10 14:21:11 +0000 |
commit | bb118b7356439a930be13962ced5f36aab9f74bf (patch) | |
tree | 5a9fad8dd6dc7f236bfc8e6b22c04cad0b837928 /gc/finalize.c | |
parent | delete old ftp site (diff) | |
download | w3m-bb118b7356439a930be13962ced5f36aab9f74bf.tar.gz w3m-bb118b7356439a930be13962ced5f36aab9f74bf.zip |
import gc6.1alpha5
Diffstat (limited to 'gc/finalize.c')
-rw-r--r-- | gc/finalize.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gc/finalize.c b/gc/finalize.c index a316010..0027bf1 100644 --- a/gc/finalize.c +++ b/gc/finalize.c @@ -207,7 +207,8 @@ signed_word * log_size_ptr; UNLOCK(); ENABLE_SIGNALS(); # endif - new_dl = GC_oom_fn(sizeof(struct disappearing_link)); + new_dl = (struct disappearing_link *) + GC_oom_fn(sizeof(struct disappearing_link)); if (0 == new_dl) { GC_finalization_failures++; return(0); @@ -433,7 +434,8 @@ finalization_mark_proc * mp; UNLOCK(); ENABLE_SIGNALS(); # endif - new_fo = GC_oom_fn(sizeof(struct finalizable_object)); + new_fo = (struct finalizable_object *) + GC_oom_fn(sizeof(struct finalizable_object)); if (0 == new_fo) { GC_finalization_failures++; return; @@ -759,8 +761,10 @@ int GC_should_invoke_finalizers GC_PROTO((void)) /* Should be called without allocation lock. */ int GC_invoke_finalizers() { - register struct finalizable_object * curr_fo; - register int count = 0; + struct finalizable_object * curr_fo; + int count = 0; + word mem_freed_before; + GC_bool first_time = TRUE; DCL_LOCK_STATE; while (GC_finalize_now != 0) { @@ -768,6 +772,10 @@ int GC_invoke_finalizers() DISABLE_SIGNALS(); LOCK(); # endif + if (first_time) { + mem_freed_before = GC_mem_freed; + first_time = FALSE; + } curr_fo = GC_finalize_now; # ifdef THREADS if (curr_fo != 0) GC_finalize_now = fo_next(curr_fo); @@ -789,6 +797,11 @@ int GC_invoke_finalizers() GC_free((GC_PTR)curr_fo); # endif } + if (mem_freed_before != GC_mem_freed) { + LOCK(); + GC_finalizer_mem_freed += (GC_mem_freed - mem_freed_before); + UNLOCK(); + } return count; } |