Re: free allocated memory: HOW ?
| From: | Edward Vermillion | Date: | Thu, 12 Apr 2007 20:58:09 +0000 |
| Subject: | Re: free allocated memory: HOW ? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252789@lists.php.net to get a copy of this message | ||
On Apr 12, 2007, at 3:04 PM, Jochem Maas wrote:
Edward Vermillion wrote:[snip]On Apr 12, 2007, at 11:17 AM, Jochem Maas wrote:Arthur Erdös wrote:int memory_get_usage ( [bool $real_usage] ) Returns the amount of memory, in bytes, that's currently being allocated to your PHP script.
I got the impression that the OP hadn't really narrowed down where the memory gobbling portion of the script was and was just looking at an overall memory usage of the total process. Then the mention of newsletter and I immediately thought image. Although a later post I read made it sound like a memory leak in the code, maybe a variable that's holding data for some operation, or an object that's created each iteration, that's not being emptied or reused or destroyed before the next go-round. Leading to a slow consumption of memory over time. Edokay - good point - but in this case the OP is reading in an html template file, just a string of 20.7Kb, what could go wrong there?It can if you're trying to process a borked image... I've had imagecreatefromjpeg() eat memory up to almost 50x the size of the image before finally deciding it can't handle it and crapping out. That was *after* running it through getimagesize() with no problem at all.php will not turn a 20.7Kb file into 400+ Megs of consumed memory - unless your read and store it in memory 20000 odd times.