Skip to content

Commit 0fb2374

Browse files
committed
Make GC default threshold handling consistent
While the initial threshold is set to 10001 roots, the threshold adjustment logic may then set it to 10000. The exact value really doesn't matter, but we should make it consistent.
1 parent 078df4d commit 0fb2374

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Zend/zend_gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
#define GC_MAX_UNCOMPRESSED (512 * 1024)
178178
#define GC_MAX_BUF_SIZE 0x40000000
179179

180-
#define GC_THRESHOLD_DEFAULT 10000
180+
#define GC_THRESHOLD_DEFAULT (10000 + GC_FIRST_ROOT)
181181
#define GC_THRESHOLD_STEP 10000
182182
#define GC_THRESHOLD_MAX 1000000000
183183
#define GC_THRESHOLD_TRIGGER 100
@@ -501,7 +501,7 @@ ZEND_API zend_bool gc_enable(zend_bool enable)
501501
GC_G(buf) = (gc_root_buffer*) pemalloc(sizeof(gc_root_buffer) * GC_DEFAULT_BUF_SIZE, 1);
502502
GC_G(buf)[0].ref = NULL;
503503
GC_G(buf_size) = GC_DEFAULT_BUF_SIZE;
504-
GC_G(gc_threshold) = GC_THRESHOLD_DEFAULT + GC_FIRST_ROOT;
504+
GC_G(gc_threshold) = GC_THRESHOLD_DEFAULT;
505505
gc_reset();
506506
}
507507
return old_enabled;

0 commit comments

Comments
 (0)