diff --git a/Zend/tests/gc_037.phpt b/Zend/tests/gc_037.phpt index a1f33f047f1..268f8f184dc 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-- 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 c03eea82b50..e4d3b2df5c7 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 69a24d44be2..ea19a77573e 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 57cdce4a27a..73111bef195 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);