php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41675 memory being exhausted easily
Submitted: 2007-06-13 00:34 UTC Modified: 2007-06-25 18:58 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: wiggum24 at gmail dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 5.2.3 OS: Redhat Enterprise Linux 4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wiggum24 at gmail dot com
New email:
PHP Version: OS:

 

 [2007-06-13 00:34 UTC] wiggum24 at gmail dot com
Description:
------------
Since upgrading from 5.1.? to 5.2.3, we're having problems with memory limits being exhausted, we never encountered this problem previously.

Our memory_limit on all production servers was set to 8 meg and we never had a problem, after this upgrade I've knocked it up to 64 meg and we're still having problems with some scripts. Some instances give "memory limit exhausted", the scripts just stops without generating an error in other instances.

Error is reproducable, the same scripts stop consistently. Pulling a large recordset out of a database is usually the culprit, but it happens with both MS SQL server and Postgres.

I've done a bit of googling, other people are experiencing this inflated memory requirement problem.

Reproduce code:
---------------
$sql="SELECT * FROM blah WHERE foo=1";
$rs=$db->query($sql);

Expected result:
----------------
For it to return my recordset :)

Actual result:
--------------
Either:
- script stops mid execution without error
- generates "memory limit exhausted" error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-13 07:49 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.
 [2007-06-13 23:53 UTC] wiggum24 at gmail dot com
I've done a bit of fiddling with while loops concatenating strings, they seem to act relatively consistently and halt correctly with errors in the right places. I suspect it's something in the db layer, but it's only a hunch and I can't really be more concise.

It shows up when you pull a few too many tuples out of a database which could sound like the developer's doing something silly, but the apps were working well with an 8 meg limit in 5.1.*

An increase didn't suprise me, it was really the magnitude of the increase that caused concern.

Sorry I can't be of more help :( Someone else may be able to provide you with better information, but in the interim I figured it doesn't hurt to help establish a pattern. You're welcome to close this report.
 [2007-06-19 08:43 UTC] informatica at diputacionavila dot es
I have the same issue since version 5.2.1, 5.2.0 works fine with memory limit 8M. Here is a script that needs a photo named temp.jpg (min size 2272x1704pixels):

<?php

function foto() {

	$f = ImageCreateFromJpeg("temp.jpg");
	list($A,$L) = GetImageSize("temp.jpg");

	$i = ImageCreateTrueColor(800,600);
	ImageCopyResized($i,$f,0,0,0,0,800,600,$A,$L);

	ImageInterlace($i,1);
	ImageJpeg($i,"foto.jpg",85);
	ImageDestroy($i);
	ImageDestroy($f);
}

foto();
echo "<img src='temp.jpg' width=400px> <hr> <img src='foto.jpg' width=400px>";

?>
 [2007-06-25 18:58 UTC] tony2001@php.net
GD converts images to its internal format first and then processes them.
This format consumes a lot of memory and this is expected behaviour.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 01:01:30 2024 UTC