|
Posted by ljb on 04/20/07 00:48
andre@webkr.de wrote:
> Hi,
>
> is there a difference between imagedestroy($ih) and unset($ih)?
>
> The same with other similar functions like closedir, mysql_close,
> curl_close, mysql_free_result, etc.
>
> And by the way... will the garbage collector even detect an "implicit
> unset" when a resource is used for the last time?
In the case of GD, I think imagedestroy does nothing more than unset. But
you probably should not assume that in general. If the resource is properly
implemented, then yes unsetting it should do all the necessary cleanup.
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.
Navigation:
[Reply to this message]
|