473,320 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP scripts causing (big!) memory leaks??

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?
Jul 16 '05 #1
4 16644

"Maurice" <sp**@debijl.net> wrote in message
news:2b**************************@posting.google.c om...
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?


I haven't a clue - and don't think anybody else will without examining the
functions called in your script... however I was wondering why you're using
older versions of Apache and PHP? Upgrading to Apache 1.3.28 and PHP 4.3.3
could help plug whatever leaks you're experiencing (and make your system
more secure).
Jul 16 '05 #2
Jon
Most likely it's your scripts. Are you doing large database operations,
etc?
"Maurice" <sp**@debijl.net> wrote in message
news:2b**************************@posting.google.c om...
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?

Jul 16 '05 #3
Maurice <sp**@debijl.net> wrote:
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:
[snip] 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 [snip]
What are the common pitfalls in PHP scripts that can cause such big
memory leaks?


Hi Maurice,

One common cause is the use of mysql_pconnect() - the implementation of
persistent db connections in PHP is not very stable.
Check your PHP scripts and change to mysql_connect().

HTH;
JOn

Jul 17 '05 #4

"Maurice" <sp**@debijl.net> wrote in message
news:2b**************************@posting.google.c om...
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?


You using the XML functions? They can cause this problem.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert | last post by:
Hi, I am building with VS 6.0 under WinXP, and building with the default python configuration & settings. I build a test python app with just the following code: /* testing for memory leaks...
2
by: Generic Usenet Account | last post by:
I have been using STL for a long time now, without any problems. Recently we generated a purification report on our software using Rational Purify, and we found some memory leaks. My colleague...
5
by: Valerie Hough | last post by:
Currently our client runs one particular C# .NET executable, and after a few hours performance slows to a crawl. It would be very useful for me to be able to rule in (or out) the possibility that...
3
by: Bhargavan | last post by:
Hi group, I have created a User control and whenever I use that usercontrol in a form, there is a memory leak. When I open and close the form, the form along with my user control is not disposed....
2
by: ASP.Confused | last post by:
How would I go about detecting a memory leak? My web hosting provider has our site set up to only have a root "bin" folder for .NET apps, and I would like to be able to watch how much memory is...
2
by: James Hunter Ross | last post by:
Friends, I've been watching or W3WP process size (using Task Manager), and it grows and grows when using our application. I am the only one on our server. I'll end my session, either through...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
6
by: Andrew Poulos | last post by:
If I code something like the following it results in a memory leak in IE (as Leak 0.5 tells me): var frm = document.createElement("FORM"); document.body.appendChild(frm); fDeleteForm =...
13
by: Ilias Lazaridis | last post by:
How to detect memory leaks of python programms, which run in an environment like this: * Suse Linux 9.3 * Apache * mod_python The problem occoured after some updates on the infrastructure....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.