I'm NOT a expert in this field. My POV may be quite dumb, but it may
point to a solution.

If memory is allocated, I would assume that somewhere there is a
mechanism to access it otherwise this is a memory leak.

So, rather than counting the memory in real time, why not have the
memory_get_usage() (not sure about peak usage) simply iterate the used
memory and calculate how much there is.

This would put the overhead in the function call and not throughout
the rest of the code.

On 27/07/06, Ilia Alshanetsky <[EMAIL PROTECTED]> wrote:

On 27-Jul-06, at 6:02 AM, Matt W wrote:
>
> Something else I'd like to see changed...  Does anyone think
> memory_get_[peak_]usage() should *always* be available, regardless of
> whether memory_limit is actually enabled?  Using the Windows
> binaries at
> least, I was devastated :-D that they were unavailable for
> experimenting,
> etc.

Counting memory all the time adds a fair amount of overhead to script
execution especially given how frequently PHP needs to allocate
memory. Therefore usage memory utilization functions are only
available when PHP is compiled with memory in which case it keeps
track of its mem usage.

--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&amp;r=213474731
"Standing on the shoulders of some very clever giants!"

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to