improve interaction of incremental mode and finalization
Really, just improve when majors GCs are forced to trigger further finalizations. This improvement makes `(collect-garbage)` followed by `(collect-garbage 'incremental)` move more reliably into incremental mode.
This commit is contained in:
parent
71d80bace5
commit
a389678556
|
@ -613,7 +613,10 @@ immediate garbage collection, but instead requests that each minor
|
|||
collection perform incremental work up to the next major collection.
|
||||
The request expires with the next major collection. Make a call to
|
||||
@racket[(collect-garbage 'incremental)] in any periodic task within
|
||||
an application that needs to be responsive in real time.
|
||||
an application that needs to be responsive in real time. Force a
|
||||
full collection with @racket[(collect-garbage)] just before an initial
|
||||
@racket[(collect-garbage 'incremental)] to initiate incremental mode
|
||||
from an optimal state.
|
||||
|
||||
To check whether incremental mode is use and how it affects pause
|
||||
times, enable @tt{debug}-level logging output for the
|
||||
|
|
|
@ -5811,6 +5811,9 @@ static void garbage_collect(NewGC *gc, int force_full, int no_full, int switchin
|
|||
incremental mode has been enabled: */
|
||||
|| ((gc->since_last_full > FORCE_MAJOR_AFTER_COUNT)
|
||||
&& !gc->started_incremental)
|
||||
|| (gc->full_needed_for_finalization
|
||||
&& !gc->incremental_requested
|
||||
&& !gc->started_incremental)
|
||||
/* In incremental mode, GC earlier if we've done everything
|
||||
that we can do incrementally. */
|
||||
|| (gc->started_incremental
|
||||
|
@ -5823,12 +5826,13 @@ static void garbage_collect(NewGC *gc, int force_full, int no_full, int switchin
|
|||
return;
|
||||
}
|
||||
|
||||
next_gc_full = gc->gc_full && !gc->started_incremental;
|
||||
next_gc_full = (gc->gc_full
|
||||
&& !gc->started_incremental
|
||||
&& !gc->full_needed_for_finalization);
|
||||
|
||||
if (gc->full_needed_for_finalization) {
|
||||
if (gc->full_needed_for_finalization && gc->gc_full)
|
||||
gc->full_needed_for_finalization= 0;
|
||||
gc->gc_full = 1;
|
||||
}
|
||||
|
||||
#ifdef GC_DEBUG_PAGES
|
||||
if (gc->gc_full == 1) {
|
||||
GCVERBOSEprintf(gc, "GC_FULL gc: %p MASTER: %p\n", gc, MASTERGC);
|
||||
|
|
Loading…
Reference in New Issue
Block a user