note 86347 deleted from function.unset by googleguy
| From: | googleguy@php.net | Date: | Wed, 16 Jan 2013 05:38:48 +0000 |
| Subject: | note 86347 deleted from function.unset by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193106@lists.php.net to get a copy of this message | ||
Note Submitter: molotster on google mail com
----
unset() does just what it's name says - unset a variable. It does not force immediate memory
freeing. PHP's garbage collector will do it when it see fits - by intention as soon, as those
CPU cycles aren't needed anyway, or as late as before the script would run out of memory,
whatever occurs first.
If you are doing $whatever = null; then you are rewriting variable's data. You might get memory
freed / shrunk faster, but it may steal CPU cycles from the code that truly needs them sooner,
resulting in a longer overall execution time.