Hi Richard,

Tuesday, May 22, 2007, 1:24:35 AM, you wrote:

>> I would have expected (or rather, hoped) that the memory use would
>> have dropped down quite dramatically after destroying the image
>> resource that was using up nearly 4MB of memory, but it didn't seem to
>> change.

> How are you measuring this?


> What version of PHP?

5.2.2 (I did say :)

> The Memory Manager changed over the course of time.

Sure, but I'm only interested in how it works now :)

> I'm also not at all sure that you *can* measure it as precisely as you
> are trying to do.

I don't think you can measure it *accurately* right down to the byte,
but with big sweeping operations such as image resource deletion you
should see significant changes in value, and in some circumstances you
do (see blog link at the bottom)

> That said:
> PHP doesn't really allocate that 5.2M of RAM.
> GD does.

Horses for courses, surely? PHP asks GD to do it, the end result is
the same, the memory is being used.

> PHP may not be able to tell you accurately about what GD is doing
> internally -- but it's probably not *really* losing that 5.2M or you'd
> hear an awful lot more screaming about it from all quarters. :-)

True :)

Using the 5MB in the first place doesn't bother me, that's just a
simple allowance for each pixel of the image + RGB/Alpha values, which
is how GD works with it. What I found fascinating on further research
was how the memory can still be used depending simply on how you store
the image resource.

After more research I wrote about it here:


Zend Certified Engineer

"Never trust a computer you can't throw out of a window"

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to