note 48747 deleted from function.unset by googleguy
| From: | googleguy@php.net | Date: | Fri, 14 Dec 2012 05:59:56 +0000 |
| Subject: | note 48747 deleted from function.unset by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192525@lists.php.net to get a copy of this message | ||
Note Submitter: Nghia
----
I saw this mentioned somewhere else but if you do
$var = NULL
then I've noticed less memory usuage than with unset(). In fact, unset didn't do anything.
This might be useful if you're doing a php-gtk app, thats starting to consume significant
memory over a long period of time. This was the code I used to test
// Check memory before here
for($i = 0; $i < 100; $i++)
{
$dialog = &new GtkDialog();
$dialog->realize();
$dialog->destroy();
$dialog = NULL;
//unset($dialog);
}
// Check memory after here
Doing a difference between after and before results in:
Using destroy() and unset() -> ~31kb
Using $dialog = NULL -> ~13 kb
The expected memory usuage should be 0kb or around there.