You are here: Re: imagedestroy and similar « PHP Programming Language « IT news, forums, messages
Re: imagedestroy and similar

Posted by Jerry Stuckle on 04/20/07 12:33

gosha bine wrote:
> On 20.04.2007 02:17 André Hänsel wrote:
>> Hi,
>>
>> is there a difference between imagedestroy($ih) and unset($ih)?
>
> No. unset() checks if a variable is referenced elsewhere and if not,
> destroys the variable and its value immediately. This is called
> "reference counting".
>
>>
>> The same with other similar functions like closedir, mysql_close,
>> curl_close, mysql_free_result, etc.
>
> Yes, if an extension author took care of registering his destructor in
> zend core.
>
>>
>> And by the way... will the garbage collector even detect an "implicit
>> unset" when a resource is used for the last time?
>
> php doesn't use "garbage collector", memory is reclaimed immediately as
> it becomes inaccesible.
>
>>
>> Regards,
>> André
>>
>
>

Andre,

Not completely true.

Yes, memory is reclaimed immediately when you unset the resource. But if
you don't unset it before the end of the page, there may be a delay
before PHP gets around to cleaning things up. It doesn't necessarily do
it immediately.

Also, there is a garbage collector for sessions to clean up old session
files. But that's different.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация