[nycphp-talk] Mod_auth_digest/mysql works!
Tim Gales
tgales at tgaconnect.com
Tue Feb 3 22:53:48 EST 2009
Michael B Allen wrote:
> On Tue, Feb 3, 2009 at 5:26 PM, Daniel Convissor
> <danielc at analysisandsolutions.com> wrote:
>
>> Hey Again Mike:
>>
>> On Tue, Feb 03, 2009 at 05:21:52PM -0500, Daniel Convissor wrote:
>>
>>> On Tue, Feb 03, 2009 at 03:29:09PM -0500, Michael B Allen wrote:
>>>
>>>> 3. PHP does not have garbage collection
>>>>
>>> Yes it does. That's what the various gc_* php.ini settings are for:
>>> http://php.net/session.configuration
>>>
>> Doh! Those are for session garbage collection. None the less, PHP does
>> have garbage collection.
>>
>
> Not really. But it wouldn't be hard to split some hairs in this conversation.
>
> My understanding is that true "garbage collection" doesn't immediately
> free objects when they fall out of scope or when they're set to nil
> but rather maintains table references that can be used to periodically
> figure out how to efficiently free things later. Usually there's a
> background process that does this in a way that allows programs to
> "run wild" but then free things when the CPU becomes idle or if free
> memory runs low.
>
> I'm not an expert on this stuff so my description is probably
> oversimplified but PHP does not do the above. It just frees everything
> as soon as it's unset. Or maybe it waits to some degree but I don't
> think there's a sophisticated algorithm behind it, it doesn't maintain
> a separate table of allocations (the zvals and resources *are* the
> allocation table) and it doesn't use a separate process to do any of
> this. GC has never been a really high priority since PHP scripts are
> usually fairly short lived.
>
Here is an interesting article on memory management:
http://www.webreference.com/programming/php_mem/index.html
(it is excerpted from Sara Goleman's book 'Extending and Embedding PHP' )
Also zend_gc.h and zend_gc.c are of interest
More information about the talk
mailing list