Hi there,
I'm experiencing big memory problems on my webserver. First on an old
RedHat 7.2 system, now on an other fresh installed Suse 8.2 system:
Linux version 2.4.20-4GB (ro**@Pentium.suse.de) (gcc version 3.3
20030226 (prerelease) (SuSE Linux)) #1 Wed Aug 6 18:26:21 UTC 2003
Apache 1.3.27-41
PHP 4.3.1-52
MySQL 3.23.55-20
Problem is that the system is running out of memory after a while due
to memory leaks, then it starts (almost randomly) killing processes:
dmesg:
__alloc_pages: 0-order allocation failed (gfp=0xf0/0)
__alloc_pages: 0-order allocation failed (gfp=0x1d2/0)
VM: killing process httpd
The memory leak is in the httpd process (thus in Apache, PHP or my
scripts). It grows (within hours) to several hundreds (!) of MB. To
limit the impact of the leaks I changed /etc/httpd/httpd.conf:
MaxRequestsPerChild 10000
This gave the system some breath: after this change the httpd
processes only take a maximum of 12 MB (scripts may take 8 MB as
configured in /etc/php.ini, the rest is probably taken by Apache).
Does anyone of you guys know of existing memory leaks in the above
Apache and PHP packages? It is possible that I have memory leaks in my
script, but I don't understand why they are causing problems now
(after running for over a year without problems).
What are the common pitfalls in PHP scripts that can cause such big
memory leaks?