com php-src: Added num_roots to gc_status: Zend/tes ts/gc_037.phpt Zend/zend_builtin_functions.c Zend/zend_gc.c Zend/zend_gc.h
| From: | Xinchen Hui | Date: | Wed, 13 Jun 2018 08:41:51 +0000 |
| Subject: | com php-src: Added num_roots to gc_status: Zend/tes ts/gc_037.phpt Zend/zend_builtin_functions.c Zend/zend_gc.c Zend/zend_gc.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-102141@lists.php.net to get a copy of this message | ||
Commit: 9465ec4673ccce985e093bea0786ff5c6d0e07ac
Author: Xinchen Hui <laruence@gmail.com> Wed, 13 Jun 2018 16:41:51 +0800
Parents: e788e8261ea8eb1b363377f1b185ac6b338607ed
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9465ec4673ccce985e093bea0786ff5c6d0e07ac
Log:
Added num_roots to gc_status
Changed paths:
M Zend/tests/gc_037.phpt
M Zend/zend_builtin_functions..c
M Zend/zend_gc.c
M Zend/zend_gc.h
Diff:
diff --git a/Zend/tests/gc_037.phpt b/Zend/tests/gc_037.phpt
index a1f33f0..268f8f1 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 c03eea8..e4d3b2d 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 69a24d4..ea19a77 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 57cdce4..73111be 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);