double full GCs to help clean up after finalizers
svn: r7809
This commit is contained in:
parent
9ed266faaf
commit
11b45ef610
|
@ -2872,6 +2872,12 @@ extern double scheme_get_inexact_milliseconds(void);
|
||||||
# define TIME_DONE() /**/
|
# define TIME_DONE() /**/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Full GCs trigger finalization. Finalization releases data
|
||||||
|
in the old generation. So one more full GC is needed to
|
||||||
|
really clean up. The another_full flag triggers the
|
||||||
|
second full GC. */
|
||||||
|
static int another_full;
|
||||||
|
|
||||||
static void garbage_collect(int force_full)
|
static void garbage_collect(int force_full)
|
||||||
{
|
{
|
||||||
static unsigned long number = 0;
|
static unsigned long number = 0;
|
||||||
|
@ -2879,6 +2885,7 @@ static void garbage_collect(int force_full)
|
||||||
static unsigned int running_finalizers = 0;
|
static unsigned int running_finalizers = 0;
|
||||||
static unsigned long last_full_mem_use = (20 * 1024 * 1024);
|
static unsigned long last_full_mem_use = (20 * 1024 * 1024);
|
||||||
unsigned long old_mem_use = memory_in_use;
|
unsigned long old_mem_use = memory_in_use;
|
||||||
|
int orig_gc_full;
|
||||||
TIME_DECLS();
|
TIME_DECLS();
|
||||||
|
|
||||||
/* determine if this should be a full collection or not */
|
/* determine if this should be a full collection or not */
|
||||||
|
@ -2888,6 +2895,13 @@ static void garbage_collect(int force_full)
|
||||||
/* gc_full, force_full, !generations_available, */
|
/* gc_full, force_full, !generations_available, */
|
||||||
/* (since_last_full > 100), (memory_in_use > (2 * last_full_mem_use))); */
|
/* (since_last_full > 100), (memory_in_use > (2 * last_full_mem_use))); */
|
||||||
|
|
||||||
|
orig_gc_full = gc_full;
|
||||||
|
|
||||||
|
if (another_full) {
|
||||||
|
another_full = 0;
|
||||||
|
gc_full = 1;
|
||||||
|
}
|
||||||
|
|
||||||
number++;
|
number++;
|
||||||
INIT_DEBUG_FILE(); DUMP_HEAP();
|
INIT_DEBUG_FILE(); DUMP_HEAP();
|
||||||
|
|
||||||
|
@ -3046,6 +3060,9 @@ static void garbage_collect(int force_full)
|
||||||
}
|
}
|
||||||
|
|
||||||
DUMP_HEAP(); CLOSE_DEBUG_FILE();
|
DUMP_HEAP(); CLOSE_DEBUG_FILE();
|
||||||
|
|
||||||
|
if (orig_gc_full)
|
||||||
|
another_full = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MZ_GC_BACKTRACE
|
#if MZ_GC_BACKTRACE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user