1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00
Grégoire Pineau
2023-03-30 17:41:34 +02:00
committed by GitHub
parent 5832a97c69
commit cff46537f9

View File

@@ -350,7 +350,7 @@ a: (refcount=2, is_ref=1)=array (
<para>
Traditionally, reference counting memory mechanisms, such as that used
previously by PHP, fail to address circular reference memory leaks;
however, as of 5.3.0, PHP implements the synchronous algorithm from the
however, as of 5.3.0, PHP implements the synchronous algorithm from the
<link xlink:href="&url.gc-paper;">Concurrent Cycle Collection in Reference Counted Systems</link>
paper which addresses that issue.
</para>
@@ -363,7 +363,7 @@ a: (refcount=2, is_ref=1)=array (
be created when a refcount argument is decreased to a non-zero value.
Secondly, in a garbage cycle, it is possible to discover which parts are
garbage by checking whether it is possible to decrease their refcount by
one, and then checking which of the zvals have a refcount of zero.
one, and then checking which of the zvals have a refcount of zero.
</para>
<para>
<mediaobject>
@@ -405,7 +405,7 @@ a: (refcount=2, is_ref=1)=array (
When the garbage collector is turned on, the cycle-finding algorithm as
described above is executed whenever the root buffer runs full. The root
buffer has a fixed size of 10,000 possible roots (although you can alter
this by changing the <literal>GC_ROOT_BUFFER_MAX_ENTRIES</literal> constant in
this by changing the <constant>GC_DEFAULT_THRESHOLD</constant> constant in
<literal>Zend/zend_gc.c</literal> in the PHP source code, and re-compiling
PHP). When the garbage collector is turned off, the cycle-finding
algorithm will never run. However, possible roots will always be recorded
@@ -417,7 +417,7 @@ a: (refcount=2, is_ref=1)=array (
collection mechanism is turned off, further possible roots will simply not
be recorded. Those possible roots that are not recorded will never be
analyzed by the algorithm. If they were part of a circular reference
cycle, they would never be cleaned up and would create a memory leak.
cycle, they would never be cleaned up and would create a memory leak.
</para>
<para>
The reason why possible roots are recorded even if the mechanism has been
@@ -435,7 +435,7 @@ a: (refcount=2, is_ref=1)=array (
setting. It is also possible to force the collection of cycles even if the
possible root buffer is not full yet. For this, you can use the
<function>gc_collect_cycles</function> function. This function will return
how many cycles were collected by the algorithm.
how many cycles were collected by the algorithm.
</para>
<para>
The rationale behind the ability to turn the mechanism on and off, and to