GC_API GC_ATTR_DEPRECATED int GC_full_freq;
/* Number of partial collections between */
/* full collections. Matters only if */
- /* GC_incremental is set. */
+ /* GC_is_incremental_mode(). */
/* Full collections are also triggered if */
/* the collector detects a substantial */
/* increase in the number of in-use heap */
/* Safe to call before GC_INIT(). Includes a GC_init() call. */
GC_API void GC_CALL GC_enable_incremental(void);
+/* Return non-zero (TRUE) if and only if the incremental mode is on. */
+/* Does not acquire the lock. */
+GC_API int GC_CALL GC_is_incremental_mode(void);
+
/* Does incremental mode write-protect pages? Returns zero or */
/* more of the following, or'ed together: */
#define GC_PROTECTS_POINTER_HEAP 1 /* May protect non-atomic objects. */
# endif
GC_COND_INIT();
GC_set_warn_proc(warn_proc);
-# if (defined(MPROTECT_VDB) || defined(PROC_VDB) || defined(GWW_VDB)) \
- && !defined(MAKE_BACK_GRAPH) && !defined(NO_INCREMENTAL)
- GC_enable_incremental();
- GC_printf("Switched to incremental mode\n");
-# ifdef PROC_VDB
- GC_printf("Reading dirty bits from /proc\n");
-# elif defined(GWW_VDB)
- GC_printf("Using GetWriteWatch-based implementation\n");
-# ifdef MPROTECT_VDB
- GC_printf("Or emulating dirty bits with mprotect/signals\n");
-# endif
-# else /* MPROTECT_VDB && !GWW_VDB */
- GC_printf("Emulating dirty bits with mprotect/signals\n");
+# if defined(MPROTECT_VDB) || defined(PROC_VDB) || defined(GWW_VDB)
+# if !defined(MAKE_BACK_GRAPH) && !defined(NO_INCREMENTAL)
+ GC_enable_incremental();
# endif
+ if (GC_is_incremental_mode()) {
+ GC_printf("Switched to incremental mode\n");
+# ifdef PROC_VDB
+ GC_printf("Reading dirty bits from /proc\n");
+# elif defined(GWW_VDB)
+ GC_printf("Using GetWriteWatch-based implementation\n");
+# ifdef MPROTECT_VDB
+ GC_printf("Or emulating dirty bits with mprotect/signals\n");
+# endif
+# else /* MPROTECT_VDB && !GWW_VDB */
+ GC_printf("Emulating dirty bits with mprotect/signals\n");
+# endif
+ }
# endif
run_one_test();
check_heap_stats();
}
# endif
n_tests = 0;
-# if defined(MPROTECT_VDB) && !defined(REDIRECT_MALLOC) \
- && !defined(MAKE_BACK_GRAPH) && !defined(USE_PROC_FOR_LIBRARIES) \
- && !defined(NO_INCREMENTAL)
+# if defined(MPROTECT_VDB)
+# if !defined(REDIRECT_MALLOC) && !defined(MAKE_BACK_GRAPH) \
+ && !defined(USE_PROC_FOR_LIBRARIES) && !defined(NO_INCREMENTAL)
GC_enable_incremental();
- GC_printf("Switched to incremental mode\n");
- GC_printf("Emulating dirty bits with mprotect/signals\n");
+# endif
+ if (GC_is_incremental_mode()) {
+ GC_printf("Switched to incremental mode\n"
+ "Emulating dirty bits with mprotect/signals\n");
+ }
# endif
GC_set_warn_proc(warn_proc);
if ((code = pthread_key_create(&fl_key, 0)) != 0) {