php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
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. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-24 22:23 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2010-10-24 22:23 UTC] kalle@php.net
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: Sun Apr 14 04:01:27 2024 UTC