summaryrefslogtreecommitdiff
path: root/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'alloc.c')
-rw-r--r--alloc.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/alloc.c b/alloc.c
index 0a4435b4..a2505ad5 100644
--- a/alloc.c
+++ b/alloc.c
@@ -417,9 +417,11 @@ GC_API void GC_CALL GC_start_incremental_collection(void)
if (!GC_incremental) return;
LOCK();
GC_should_start_incremental_collection = TRUE;
- ENTER_GC();
- GC_collect_a_little_inner(1);
- EXIT_GC();
+ if (!GC_dont_gc) {
+ ENTER_GC();
+ GC_collect_a_little_inner(1);
+ EXIT_GC();
+ }
UNLOCK();
# endif
}
@@ -715,8 +717,6 @@ GC_INNER void GC_collect_a_little_inner(int n)
IF_CANCEL(int cancel_state;)
GC_ASSERT(I_HOLD_LOCK());
- if (GC_dont_gc) return;
-
DISABLE_CANCEL(cancel_state);
if (GC_incremental && GC_collection_in_progress()) {
int i;
@@ -734,7 +734,7 @@ GC_INNER void GC_collect_a_little_inner(int n)
GC_parallel_mark_disabled = FALSE;
# endif
- if (i < max_deficit) {
+ if (i < max_deficit && !GC_dont_gc) {
/* Need to finish a collection. */
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
@@ -765,7 +765,7 @@ GC_INNER void GC_collect_a_little_inner(int n)
if (GC_deficit < 0)
GC_deficit = 0;
}
- } else {
+ } else if (!GC_dont_gc) {
GC_maybe_gc();
}
RESTORE_CANCEL(cancel_state);
@@ -780,9 +780,11 @@ GC_API int GC_CALL GC_collect_a_little(void)
DCL_LOCK_STATE;
LOCK();
- ENTER_GC();
- GC_collect_a_little_inner(1);
- EXIT_GC();
+ if (!GC_dont_gc) {
+ ENTER_GC();
+ GC_collect_a_little_inner(1);
+ EXIT_GC();
+ }
result = (int)GC_collection_in_progress();
UNLOCK();
if (!result && GC_debugging_started) GC_print_all_smashed();
@@ -1759,7 +1761,8 @@ GC_INNER ptr_t GC_allocobj(size_t gran, int kind)
while (*flh == 0) {
ENTER_GC();
# ifndef GC_DISABLE_INCREMENTAL
- if (GC_incremental && GC_time_limit != GC_TIME_UNLIMITED) {
+ if (GC_incremental && GC_time_limit != GC_TIME_UNLIMITED
+ && !GC_dont_gc) {
/* True incremental mode, not just generational. */
/* Do our share of marking work. */
GC_collect_a_little_inner(1);
@@ -1782,7 +1785,7 @@ GC_INNER ptr_t GC_allocobj(size_t gran, int kind)
if (NULL == *flh) {
ENTER_GC();
if (GC_incremental && GC_time_limit == GC_TIME_UNLIMITED
- && !tried_minor) {
+ && !tried_minor && !GC_dont_gc) {
GC_collect_a_little_inner(1);
tried_minor = TRUE;
} else {