|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27758 High memory usage/leak
Submitted: 2004-03-29 15:05 UTC Modified: 2004-06-03 12:00 UTC
Avg. Score:4.8 ± 0.5
Reproduced:20 of 20 (100.0%)
Same Version:12 (60.0%)
Same OS:7 (35.0%)
From: tingle at virtuanews dot co dot uk Assigned:
Status: Closed Package: Performance problem
PHP Version: 5CVS-2004-03-29 (dev) OS: Windows 2000 SP4
Private report: No CVE-ID: None
 [2004-03-29 15:05 UTC] tingle at virtuanews dot co dot uk

Whilst using PHP locally I am experiencing a major problem with memory usage.

When I start up apache it uses around 15mb of memory (apache.exe that is)

Now as a test I sat hitting refresh on the index page of phpmyadmin installed locally for a few minutes, and the memory usage of apache.exe reached 150mb +.  It seems to be using a certain amount of memory to load the page, then not releasing it as the usage never goes down, only up with each page refresh.

This issue does NOT happen with PHP4, I am using the latest CVS version of PHP5 compiled by you for windows.  I also have apache 2.0.49 and mysql 4.0.18 installed.

I realise this is a pretty usless bug report in terms of finding a solution, but that is because I do not know what to give you.

Please let me know how I can help to solve this problem - I'm sure needed to restart apahe after every thousand or so page refreses due to memory usage of nearly 200mb is not the intended use of PHP!




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-07 05:25 UTC]
Please try using this CVS snapshot:
For Windows:

 [2004-04-12 17:56 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2004-04-18 10:35 UTC] tingle at virtuanews dot co dot uk

Sorry for the delay - I was not in a position to download the latest CVS due to a very slow web connection, this has now changed and I have just downloaded the latest file.

The problem is now MUCH better, but is still there slightly, where as before it would increase with about 500KB each refresh, it does it by about 50KB each time.

It is not as bad, but it is still there
 [2004-05-03 20:53 UTC] jpleveille at gameloft dot com
I noticed that on the RC2. Is that fixed? I got memory usage increased of 1 to 8 megabytes sometimes. Have to reload Apache every 10 minutes sometimes, annoying!

 [2004-05-07 18:40 UTC] ppmm at wuxinan dot net
Try to use Apache 2.0.48. I have exactly the same problem on the same platform. But when I go back to the older version of Apache, the problem no long exists.
 [2004-05-13 17:12 UTC] technik at perlentaucher dot de
Same Problem here. System is :

Apache 2.0.48 on Gentoo, using latest snapshot of PHP5
( php5-200405131230 )

Memory Leak happens while running following code :

for ( $x=0; $x<600; $x++ ) {
  $db = mysql_connect("localhost", "user", "password");
  $sql  = "select * from tab"; // About 17.000 Big Records
  $result = mysql_query($sql); // !!! causes MEM-Leak !!!

Mem-Leak differs in Size. When reducing load eg. by making the loop smaller it disapears sometime.
It happens at the Point where the Data ist loaded into the result-Array.

 [2004-05-25 14:46 UTC] marek at lewczuk dot com
I have the same problem - Apache 2.0.48 + latest PHP5.
 [2004-05-27 11:37 UTC] marek at lewczuk dot com
It is still not working. Right now I'm using Apache 2.0.48 and latest PHP5 build (20040527). It is really annoying - I have to reset apache every 5 minutes, because after each loaded page apache's memory usage is growing. It seems that memory used by PHP (or by php output buffer) isn't reset when page has been loaded. It is really annoying bug...
 [2004-06-03 11:56 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

 [2004-06-03 12:00 UTC]
Can you try testing with either of the following release candidates? or
 [2004-06-16 04:40 UTC] a12345 at rogers dot com
I am having the issue of high memory usage, I can resolve it with the restart of Apache server

My configuration:

WinXP Pro
Apache 2.0.49
PHP 5.0RC3
MySQL 4.0.18
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Nov 29 06:01:28 2023 UTC