diff options
-rw-r--r-- | Zend/tests/gc_037.phpt | 10 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 2 | ||||
-rw-r--r-- | Zend/zend_gc.c | 1 | ||||
-rw-r--r-- | Zend/zend_gc.h | 1 |
4 files changed, 11 insertions, 3 deletions
diff --git a/Zend/tests/gc_037.phpt b/Zend/tests/gc_037.phpt index a1f33f047f..268f8f184d 100644 --- a/Zend/tests/gc_037.phpt +++ b/Zend/tests/gc_037.phpt @@ -4,27 +4,31 @@ GC 037: gc_status() zend.enable_gc = 1 --FILE-- <?php -var_dump(gc_status()); $a = array(); $a[] =& $a; unset($a); +var_dump(gc_status()); gc_collect_cycles(); gc_collect_cycles(); var_dump(gc_status()); --EXPECT-- -array(3) { +array(4) { ["runs"]=> int(0) ["collected"]=> int(0) ["threshold"]=> int(10001) + ["roots"]=> + int(1) } -array(3) { +array(4) { ["runs"]=> int(1) ["collected"]=> int(1) ["threshold"]=> int(10001) + ["roots"]=> + int(0) } diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index c03eea82b5..e4d3b2df5c 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -401,7 +401,9 @@ ZEND_FUNCTION(gc_status) add_assoc_long_ex(return_value, "runs", sizeof("runs")-1, (long)status.runs); add_assoc_long_ex(return_value, "collected", sizeof("collected")-1, (long)status.collected); add_assoc_long_ex(return_value, "threshold", sizeof("threshold")-1, (long)status.threshold); + add_assoc_long_ex(return_value, "roots", sizeof("roots")-1, (long)status.num_roots); } +/* }}} */ /* {{{ proto int func_num_args(void) Get the number of arguments that were passed to the function */ diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 69a24d44be..ea19a77573 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -1447,6 +1447,7 @@ ZEND_API void zend_gc_get_status(zend_gc_status *status) status->runs = GC_G(gc_runs); status->collected = GC_G(collected); status->threshold = GC_G(gc_threshold); + status->num_roots = GC_G(num_roots); } /* diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h index 57cdce4a27..73111bef19 100644 --- a/Zend/zend_gc.h +++ b/Zend/zend_gc.h @@ -28,6 +28,7 @@ typedef struct _zend_gc_status { uint32_t runs; uint32_t collected; uint32_t threshold; + uint32_t num_roots; } zend_gc_status; ZEND_API extern int (*gc_collect_cycles)(void); |