|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51392 Suggestion to simplify description of GC
Submitted: 2010-03-25 21:16 UTC Modified: 2010-10-24 22:23 UTC
From: a at b dot c dot de Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: a at b dot c dot de
New email:
PHP Version: OS:


 [2010-03-25 21:16 UTC] a at b dot c dot de

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. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-24 22:23 UTC]
-Status: Open +Status: Wont fix
 [2010-10-24 22:23 UTC]
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
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 20:01:30 2024 UTC