That is, garbage collector, the full name of Garbage Collection.
-
How rubbish is defined in php?
Rather, to determine whether the waste, mainly to see if variable names point to a variable container zval, if not then considered garbage, you need to release. -
After php version 5.3 is how to handle garbage memory?
Analyzing the process
. If the refcount a zval increased, then the zval still in use is not spam
. If the refcount a zval reduced to 0, then zval can be freed, is not spam
. If, after a zval greater than the reduction refcount 0, then the zval not be released, this could become a zval garbage
is this zval each element once refcount decremented, after the operation is completed, if the zval refcount = 0, then this is a rubbish zval -
For an annular array comprising a reference, the array contains zval each element will be decremented, if it is found after the array itself zval refcount becomes 0, then the array is based on a rubbish
-
Optimization: There will be a buffer zone concept, and other one-time buffer is full will go to clear out. The default buffer can put 10,000 nodes, when the buffer is full before cleaning.
-
php.ini provided zend.enable_gc item to open or close the GC. gc_enable (): open GC gc_disable (): Close GC
gc_collect_cycles (): Forces the garbage analysis algorithm in the case of node buffer is not full - Garbage collection involves knowledge
.unset simply disconnects a connection to a variable memory area, the memory area while the reference count of -1; the memory is recovered mainly to see if the refount to 0, and the algorithm determines gc
.a = null pointing directly to a blanking data structure, while its reference count return 0
. script completes, the script used in all of the memory are released, regardless of whether there is a reference ring