W3Cschool
恭喜您成為首批注冊用戶
獲得88經驗值獎勵
(PHP 7 >= 7.3.0, PHP 8)
gc_status — 獲取有關垃圾回收的信息
gc_status(): array
獲取有關當前垃圾收集狀態(tài)的信息。
此函數(shù)沒有參數(shù)。
返回包含以下元素的關聯(lián)數(shù)組:
示例 #1 gc_status() 用法
<?php
// create object tree that needs gc collection
$a = new stdClass();
$a->b = [];
for ($i = 0; $i < 100000; $i++) {
$b = new stdClass();
$b->a = $a;
$a->b[] = $b;
}
unset($a);
unset($b);
gc_collect_cycles();
var_dump(gc_status());
以上示例的輸出類似于:
array(4) {
["runs"]=>
int(5)
["collected"]=>
int(100002)
["threshold"]=>
int(50001)
["roots"]=>
int(0)
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: