473,569 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.s use.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:
MaxRequestsPerC hild 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 16672

"Maurice" <sp**@debijl.ne t> wrote in message
news:2b******** *************** ***@posting.goo gle.com...
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.s use.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:
MaxRequestsPerC hild 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.ne t> wrote in message
news:2b******** *************** ***@posting.goo gle.com...
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.s use.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:
MaxRequestsPerC hild 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.ne t> 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:
MaxRequestsPerC hild 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.ne t> wrote in message
news:2b******** *************** ***@posting.goo gle.com...
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.s use.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:
MaxRequestsPerC hild 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
1463
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 */ long tmp_flag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); tmp_flag |= _CRTDBG_LEAK_CHECK_DF; _CrtSetDbgFlag( tmp_flag );
2
4944
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 claims that some of the memory leaks are due to the fact that "STL is wrought with memory leaks". Of course I disagree. I think that there are no...
5
4646
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 this is a result of memory leakage. Can someone point me to an article that discusses how bad programming may produce memory leaks? The...
3
1694
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. It does execute the dispose methods in my form and in my usercontrol. I am sure there is something wrong with my Usercontrol but I am not sure where...
2
1662
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 being allocated for the entire site (since the site acts as one big application.) Is there anyway to do this through code? The reason I ask is...
2
1213
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 timeout or logout, and the process size never goes down. I could understand that if the next time I logged in the size didn't change, implying that...
3
5302
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". Anybody know anything about this? Does *Javascript* leak memeory, or does the *browser* leak memory?
6
3605
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 = function() { document.body.removeChild(frm); };
13
2840
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. It's most possibly caused by trac and it's dependencies, but several components of the OS where updated, too.
0
7704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7684
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6298
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5234
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3666
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3659
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
959
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.