version 1.6, 2002/07/24 08:00:08 |
version 1.7, 2003/06/24 05:11:32 |
Line 764 int GC_invoke_finalizers() |
|
Line 764 int GC_invoke_finalizers() |
|
struct finalizable_object * curr_fo; |
struct finalizable_object * curr_fo; |
int count = 0; |
int count = 0; |
word mem_freed_before; |
word mem_freed_before; |
GC_bool first_time = TRUE; |
|
DCL_LOCK_STATE; |
DCL_LOCK_STATE; |
|
|
while (GC_finalize_now != 0) { |
while (GC_finalize_now != 0) { |
Line 772 int GC_invoke_finalizers() |
|
Line 771 int GC_invoke_finalizers() |
|
DISABLE_SIGNALS(); |
DISABLE_SIGNALS(); |
LOCK(); |
LOCK(); |
# endif |
# endif |
if (first_time) { |
if (count == 0) { |
mem_freed_before = GC_mem_freed; |
mem_freed_before = GC_mem_freed; |
first_time = FALSE; |
|
} |
} |
curr_fo = GC_finalize_now; |
curr_fo = GC_finalize_now; |
# ifdef THREADS |
# ifdef THREADS |
Line 797 int GC_invoke_finalizers() |
|
Line 795 int GC_invoke_finalizers() |
|
GC_free((GC_PTR)curr_fo); |
GC_free((GC_PTR)curr_fo); |
# endif |
# endif |
} |
} |
if (mem_freed_before != GC_mem_freed) { |
if (count != 0 && mem_freed_before != GC_mem_freed) { |
LOCK(); |
LOCK(); |
GC_finalizer_mem_freed += (GC_mem_freed - mem_freed_before); |
GC_finalizer_mem_freed += (GC_mem_freed - mem_freed_before); |
UNLOCK(); |
UNLOCK(); |
Line 814 void GC_notify_or_invoke_finalizers GC_PROTO((void)) |
|
Line 812 void GC_notify_or_invoke_finalizers GC_PROTO((void)) |
|
if (GC_finalize_now == 0) return; |
if (GC_finalize_now == 0) return; |
if (!GC_finalize_on_demand) { |
if (!GC_finalize_on_demand) { |
(void) GC_invoke_finalizers(); |
(void) GC_invoke_finalizers(); |
GC_ASSERT(GC_finalize_now == 0); |
# ifndef THREADS |
|
GC_ASSERT(GC_finalize_now == 0); |
|
# endif /* Otherwise GC can run concurrently and add more */ |
return; |
return; |
} |
} |
if (GC_finalizer_notifier != (void (*) GC_PROTO((void)))0 |
if (GC_finalizer_notifier != (void (*) GC_PROTO((void)))0 |
Line 852 void GC_notify_or_invoke_finalizers GC_PROTO((void)) |
|
Line 852 void GC_notify_or_invoke_finalizers GC_PROTO((void)) |
|
return(result); |
return(result); |
} |
} |
|
|
|
#if !defined(NO_DEBUGGING) |
|
|
|
void GC_print_finalization_stats() |
|
{ |
|
struct finalizable_object *fo = GC_finalize_now; |
|
size_t ready = 0; |
|
|
|
GC_printf2("%lu finalization table entries; %lu disappearing links\n", |
|
GC_fo_entries, GC_dl_entries); |
|
for (; 0 != fo; fo = fo_next(fo)) ++ready; |
|
GC_printf1("%lu objects are eligible for immediate finalization\n", ready); |
|
} |
|
|
|
#endif /* NO_DEBUGGING */ |