/* How many consecutive GC/expansion failures? */
/* Reset by GC_allochblk. */
+static word last_fo_entries = 0;
+static word last_bytes_finalized = 0;
+
/* Collect or expand heap in an attempt make the indicated number of */
/* free blocks available. Should be called until the blocks are */
/* available (seting retry value to TRUE unless this is the first call */
DISABLE_CANCEL(cancel_state);
if (!GC_incremental && !GC_dont_gc &&
- ((GC_dont_expand && GC_bytes_allocd > 0) || GC_should_collect())) {
+ ((GC_dont_expand && GC_bytes_allocd > 0)
+ || (GC_fo_entries > (last_fo_entries + 500)
+ && (last_bytes_finalized | GC_bytes_finalized) != 0)
+ || GC_should_collect())) {
/* Try to do a full collection using 'default' stop_func (unless */
/* nothing has been allocated since the latest collection or heap */
/* expansion is disabled). */
if (gc_not_stopped == TRUE || !retry) {
/* Either the collection hasn't been aborted or this is the */
/* first attempt (in a loop). */
+ last_fo_entries = GC_fo_entries;
+ last_bytes_finalized = GC_bytes_finalized;
RESTORE_CANCEL(cancel_state);
return(TRUE);
}
#endif
/* void GC_dump(void); - declared in gc.h */
+extern word GC_fo_entries; /* should be visible in extra/MacOS.c */
+
#ifdef KEEP_BACK_PTRS
GC_INNER void GC_store_back_pointer(ptr_t source, ptr_t dest);
GC_INNER void GC_marked_for_finalization(ptr_t dest);