Doc #51392 [Opn->Wfx]: Suggestion to simplify description of GC
| From: | kalle@php.net | Date: | Sun, 24 Oct 2010 20:23:16 +0000 |
| Subject: | Doc #51392 [Opn->Wfx]: Suggestion to simplify description of GC | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5402@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51392&edit=1
ID: 51392
Updated by: kalle@php.net
Reported by: a at b dot c dot de
Summary: Suggestion to simplify description of GC
-Status: Open
+Status: Wont fix
Type: Documentation Problem
Package: Documentation problem
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
New Comment:
This is a Wont-fix, Derick said:
The paper uses white, not blue. That's why I thought it'd be best to
keep it in the article too
Previous Comments:
------------------------------------------------------------------------
[2010-03-25 21:16:05] a at b dot c dot de
Description:
------------
http://www.php.net/manual/en/features.gc.collecting-cycles.php
In the paragraph discussing the illustration of the garbage-collection
algorithm there are three mentions of "white" zvals. The canonical
exemplar is:
'If it finds that the refcount is zero, the zval is marked "white" (blue
in the figure).'
I know the reasoning behind the black/grey/white sequence, but saying
"blue, I mean white, I mean yellooooww....." seems pointless unless one
already has that background - and there's a link to the source for such
people.
The colouring is entirely arbitrary anyway (since it's really a matter
of bit flipping and not actual hues); that paragraph would be slightly
more straightforward if the extra layer of indirection was removed and
simply referred to "blue" zvals throughout.
Expected result:
----------------
In step B, the algorithm runs a depth-first search on all possible roots
to decrease by one the refcounts of each zval it finds, making sure not
to decrease a refcount on the same zval twice (by marking them as
"grey"). In step C, the algorithm again runs a depth-first search from
each root node, to check the refcount of each zval again. If it finds
that the refcount is zero, the zval is marked "blue". If it's larger
than zero, it reverts the decreasing of the refcount by one with a
depth-first search from that point on, and they are marked "black"
again. In the last step (D), the algorithm walks over the root buffer
removing the zval roots from there, and meanwhile, checks which zvals
have been marked "blue" in the previous step. Every zval marked as
"blue" will be freed.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51392&edit=1