From: Nikita Popov Date: Fri, 23 Oct 2020 08:30:07 +0000 (+0200) Subject: Make GC default threshold handling consistent X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fb2374e06948212826454c775bece91c4221e43;p=php 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. --- diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index aa9602ff04..bfc124719c 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -177,7 +177,7 @@ #define GC_MAX_UNCOMPRESSED (512 * 1024) #define GC_MAX_BUF_SIZE 0x40000000 -#define GC_THRESHOLD_DEFAULT 10000 +#define GC_THRESHOLD_DEFAULT (10000 + GC_FIRST_ROOT) #define GC_THRESHOLD_STEP 10000 #define GC_THRESHOLD_MAX 1000000000 #define GC_THRESHOLD_TRIGGER 100 @@ -501,7 +501,7 @@ ZEND_API zend_bool gc_enable(zend_bool enable) GC_G(buf) = (gc_root_buffer*) pemalloc(sizeof(gc_root_buffer) * GC_DEFAULT_BUF_SIZE, 1); GC_G(buf)[0].ref = NULL; GC_G(buf_size) = GC_DEFAULT_BUF_SIZE; - GC_G(gc_threshold) = GC_THRESHOLD_DEFAULT + GC_FIRST_ROOT; + GC_G(gc_threshold) = GC_THRESHOLD_DEFAULT; gc_reset(); } return old_enabled;