#41675 [Com]: memory being exhausted easily

From: Date: Tue, 19 Jun 2007 08:43:53 +0000
Subject: #41675 [Com]: memory being exhausted easily
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113923@lists.php.net to get a copy of this message
ID: 41675 Comment by: informatica at diputacionavila dot es Reported By: wiggum24 at gmail dot com Status: Open Bug Type: Performance problem Operating System: Redhat Enterprise Linux 4 PHP Version: 5.2.3 New Comment: 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>"; ?> Previous Comments: ------------------------------------------------------------------------ [2007-06-13 23:53:58] 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-13 07:49:38] 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 00:34:35] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41675&edit=1

« previous php.bugs (#113923) next »