mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Added num_roots to gc_status
This commit is contained in:
parent
e788e8261e
commit
9465ec4673
4 changed files with 11 additions and 3 deletions
|
@ -4,27 +4,31 @@ GC 037: gc_status()
|
||||||
zend.enable_gc = 1
|
zend.enable_gc = 1
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
var_dump(gc_status());
|
|
||||||
$a = array();
|
$a = array();
|
||||||
$a[] =& $a;
|
$a[] =& $a;
|
||||||
unset($a);
|
unset($a);
|
||||||
|
var_dump(gc_status());
|
||||||
gc_collect_cycles();
|
gc_collect_cycles();
|
||||||
gc_collect_cycles();
|
gc_collect_cycles();
|
||||||
var_dump(gc_status());
|
var_dump(gc_status());
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
array(3) {
|
array(4) {
|
||||||
["runs"]=>
|
["runs"]=>
|
||||||
int(0)
|
int(0)
|
||||||
["collected"]=>
|
["collected"]=>
|
||||||
int(0)
|
int(0)
|
||||||
["threshold"]=>
|
["threshold"]=>
|
||||||
int(10001)
|
int(10001)
|
||||||
|
["roots"]=>
|
||||||
|
int(1)
|
||||||
}
|
}
|
||||||
array(3) {
|
array(4) {
|
||||||
["runs"]=>
|
["runs"]=>
|
||||||
int(1)
|
int(1)
|
||||||
["collected"]=>
|
["collected"]=>
|
||||||
int(1)
|
int(1)
|
||||||
["threshold"]=>
|
["threshold"]=>
|
||||||
int(10001)
|
int(10001)
|
||||||
|
["roots"]=>
|
||||||
|
int(0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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, "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, "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, "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)
|
/* {{{ proto int func_num_args(void)
|
||||||
Get the number of arguments that were passed to the function */
|
Get the number of arguments that were passed to the function */
|
||||||
|
|
|
@ -1447,6 +1447,7 @@ ZEND_API void zend_gc_get_status(zend_gc_status *status)
|
||||||
status->runs = GC_G(gc_runs);
|
status->runs = GC_G(gc_runs);
|
||||||
status->collected = GC_G(collected);
|
status->collected = GC_G(collected);
|
||||||
status->threshold = GC_G(gc_threshold);
|
status->threshold = GC_G(gc_threshold);
|
||||||
|
status->num_roots = GC_G(num_roots);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -28,6 +28,7 @@ typedef struct _zend_gc_status {
|
||||||
uint32_t runs;
|
uint32_t runs;
|
||||||
uint32_t collected;
|
uint32_t collected;
|
||||||
uint32_t threshold;
|
uint32_t threshold;
|
||||||
|
uint32_t num_roots;
|
||||||
} zend_gc_status;
|
} zend_gc_status;
|
||||||
|
|
||||||
ZEND_API extern int (*gc_collect_cycles)(void);
|
ZEND_API extern int (*gc_collect_cycles)(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue