PHP 8.1.28 Released!

gc_status

(PHP 7 >= 7.3.0, PHP 8)

gc_statusÇöp toplayıcı hakkında bilgi döndürür

Açıklama

gc_status(): array

Çöp toplayıcının geçerli durumu hakkında bilgi döndürür.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Aşağıdaki anahtarları içeren iklişkisel dizi döner:

  • "runs"
  • "collected"
  • "threshold"
  • "roots"

Örnekler

Örnek 1 - gc_status() örneği

<?php
// çöp toplayıcıya gereken nesne ağacını oluştur
$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());

Yukarıdaki örnek şuna benzer bir çıktı üretir:

array(4) {
  ["runs"]=>
  int(5)
  ["collected"]=>
  int(100002)
  ["threshold"]=>
  int(50001)
  ["roots"]=>
  int(0)
}

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top