Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got PHP processes running that occasionally have to briefly use large amounts of RAM.

After PHP uses the large amount of RAM, the httpd process seems to keep the same private dirty RSS indefinitely. Even while processing later much less memory intensive requests. Here's the relevant lines from pmap.

% tinysu pmap -x 30247
30247:   /usr/sbin/httpd
Address           Kbytes     RSS   Dirty Mode   Mapping
00002b914046f000   60712   57324   57124 rw---    [ anon ]
00002b9144cfa000   12676   12448   12448 rw---    [ anon ]
00002b9145a3b000   27400   26964   26964 rw---    [ anon ]

Will this memory ever be available for use by the rest of the system?

I keep MaxRequestPerChild in httpd.conf at 10000 for things like persistent memcached connections. Do I need to lower that value to ensure that memory is released, so that the occasional memory intensive operation doesn't eventually cause every httpd process to take up far more memory than it needs?

I tried using MaxMemFree in httpd.conf, but that didn't make any difference.

share|improve this question
    
Which version of PHP are you using? –  sciurus May 8 '11 at 1:28
    
My sample is from PHP 5.2. I just reproduced it with PHP 5.3 as well, though. –  EmptyPockets May 8 '11 at 4:04
    
For 5.3, try setting zend.enable_gc to 1. –  sciurus May 8 '11 at 5:39
    
No difference. That's for the circular reference collector anyway, and there are no circular references here. –  EmptyPockets May 9 '11 at 17:02

1 Answer 1

AFAIK no. It'll never release the memory back like that. You need to change your Apache set up so that childs are recycled often.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.