I've got a request handler running in apache/mod_php which from time to time grows past the maximum permitted memory usage (ie, the memory_limit definition in in php.ini).
Handling this request calls proc_open() to operate exterior instructions. May be the memory use of individuals instructions counted "against" the demands memory usage?
Beyond that, do you know the preferred methods to evaluate and connect memory use of scripts running under mod_php? All the details I have found around php memory usage appears to become:
- "Edit php.ini and lift the memory limit!"
- "Edit your apache config and hang max demands per child to some lower number!"
Clearly either of those might have an adverse impact on performance and stability. How do i really evaluate and repair the problem, instead of band-aid it?
Apache logs the mistake as:
PHP Fatal error: Permitted memory size of X bytes exhausted (attempted to allocate Y bytes) in foo.php online Z
I requested an identical question on PHP's memory management: http://stackoverflow.com/questions/849549/detecting-memory-leaks-in-large-php-stacks
I am fairly sure that running exterior programs from professional() or proc_open() doesn't count against php's memory limit.
Monitoring memory usage in PHP looks like it's very hard. There does not seem like way to find information about symbolic table or anything like this.
PHP includes a couple memory management functions, like [cde] and [cde], that may fetch the quantity of memory used at a reason for your script. You could write your personal monitoring script and put it, ad-hoc, at tips to locate memory hoggers.
For the way large your code-stack is, xdebug's execution trace might be your best choice. But this is often overkill for those who have plenty of code.