|
Posted by ljb on 04/21/07 00:54
jstucklex@attglobal.net wrote:
> ljb wrote:
>>>...
>> The garbage collector does not detect when a resource is used for the last
>> time. It does detect when it goes out of scope. For example, a resource
>> variable local to a function ... when the function returns, the resource
>> should be cleaned up.
>
> One correction - the gc eventually detects when the resource is no
> longer being used. But such detection is almost always not immediate,
> and may in fact take quite some time.
Just for discussion, is there a case where PHP can "detect when the
resource is no longer being used" other than when the variable referencing
the resource goes out of scope? I believe you that there is, but I can't
think of any.
Also are you saying that if the resource is a local variable in a function,
and the function returns, there can be a delay before the resource is
cleaned up (for example, a database connection is closed)?
[Back to original message]
|