faqts : Computers : Programming : Languages : PHP : kms : Classes

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

17 of 44 people (39%) answered Yes
Recently 6 of 10 people (60%) answered Yes


Does PHP have a garbage collector? or how do I release the Memory when I have done with my object ?

Aug 18th, 2004 00:52
Ayse Geertsma, John Wellum,

You don't need to free your memory. Based on what I understand from PHP
the ZEND engine is constantly collecting the garbage. As soon as a
specific part of data loses all links to variables. The number of links
is counted so if the counter reaches zero. For example:
// This line loads a lagre array of images from the animals database
$My_Large_Variable = new ImageCat('animals');
// This line SHOULD free all memory
$My_Large_Variable = NULL;
Please correct me if I'm wrong!