The "no gc" crowd

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 9 10:15:51 PDT 2013


On 10/9/13 6:06 AM, Michel Fortin wrote:
> On 2013-10-09 07:33:29 +0000, Manu <turkeyman at gmail.com> said:
>
>> Is there more to it? Cleaning up circular references I guess... what does
>> Apple do?
>
> Apple implemented auto-nulling weak pointers for ARC (as well as
> __unsafe_unretained ones if you are not afraid of dangling pointers).

Yah, the rub being the programmer must use weak pointers judiciously. 
The difficulty is in "judiciously" :o).

>> It's an uncommon edge case, so there's gotta be heaps of room for
>> efficient
>> solutions to that (afaik) one edge case. Are there others?
>
> I don't know about you, but circular references are not rare at all in
> my code.

Nor Facebook's. I can't give away numbers, but the fraction of cycles 
per total memory allocated averaged over all of Facebook's PHP programs 
(PHP being reference counted) is staggering. Staggering!

If PHP didn't follow a stateless request model (which allows us to use 
region allocation and reclaim all memory upon the request's end), we'd 
be literally unable to run a server for more than a few minutes.

> Another solution that could be used for circular references is to have
> the stop-the-world GC we have now collect them. Reference counting could
> be used to free GC memory in advance (in the absence of circular
> references), so the GC would have less garbage to collect when it runs.

Yah, that seems to be a good approach for us.


Andrei


More information about the Digitalmars-d mailing list