note 101104 added to function.memory-get-usage
| From: | lorin dot weilenmann at gmail dot com | Date: | Fri, 26 Nov 2010 09:37:55 +0000 |
| Subject: | note 101104 added to function.memory-get-usage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174373@lists.php.net to get a copy of this message | ||
I can confirm that this function triggers a garbage collection. I have a script that exceeded 128MB
of memory at some point and ended with a fatal error. I was confused, because the script dealt with
some large files initially, but the memory load from that point on should have been marginal, and
the error occurred at the very end.
Those large files were dealt in a dedicated function and i even used unset() on the variable holding
the file after the file was written to disk inside that function. So the memory should have been
cleared twice, first after the unset() call, and second once the function ended.
To debug the memory usage, I called memory_get_usage(true) at some points and echo-ed the memory
allocation. Just by adding a few echos here and there in the script, the memory usage never exceeded
1MB overhead (on top of the current file size) and the memory error disappeared.
----
Server IP: 69.147.83.197
Probable Submitter: 153.46.244.84
----
Manual Page -- http://www.php.net/manual/en/function.memory-get-usage.php
Edit -- https://master.php.net/note/edit/101104
Del: integrated -- https://master.php.net/note/delete/101104/integrated
Del: useless -- https://master.php.net/note/delete/101104/useless
Del: bad code -- https://master.php.net/note/delete/101104/bad+code
Del: spam -- https://master.php.net/note/delete/101104/spam
Del: non-english -- https://master.php.net/note/delete/101104/non-english
Del: in docs -- https://master.php.net/note/delete/101104/in+docs
Del: other reasons-- https://master.php.net/note/delete/101104
Reject -- https://master.php.net/note/reject/101104
Search -- https://master.php.net/manage/user-notes.php