On 27-Jul-06, at 9:03 AM, bertrand Gugger wrote:

Ilia Alshanetsky 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.

That may hear off topic , but how you enable something else than 8M *without* getting this counting overhead ?

Eh? When you set a limit what are you trying to do? From my experience most of the time this setting is used by hosting providers to restrict memory utilization of various PHP scripts to avoid out-of- memory situations and system abuse. As such you'd want as accurate measurement as possible including any overhead and what not, since it is possible to use the overhead to exceed or in some cases even to bypass the memory limit entirely.

It looks to me that --enable-memory-limit mixes 2 independant roles :
- setting the amount of available memory, and enabling eventually local setting,
- enabling the evaluation of the process consumption.

That is correct. Memory limit by its nature requires PHP to count the amount of memory consumed, since such tracking is performed it enabled PHP to report internally via functions (or via Apache log) about its memory utilization.

Ilia Alshanetsky

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

Reply via email to