From: pvx at pv2c dot sk
Operating system: Linux
PHP version: 4.3.2
PHP Bug Type: PostgreSQL related
Bug description: no way to free failed query => memory leak
Description:
------------
pg_query doesn't return resource for failed queries - that's not very
wise, IMHO (see related bug 18747), but the real problem with this is,
that you cannot free failed results.
It may not be noticeable if you have only a few failed queries, but it
becomes a serious problem if you have lots. Try the example code.
Reproduce code:
---------------
// assume one table "aaa" with one column "test", that is
// unique (primary key maybe)
$con=pg_connect(...);
for($t=0; $t<10000; $t++)
{
$ret = pg_query($con, "INSERT INTO aaa (test) VALUES 1");
// $ret is FALSE (cannot inset duplicate value) => no way to free it
}
Expected result:
----------------
Some way to free the result resource...
Actual result:
--------------
PHP memory consumption grows *really fast*, in my case it even ignores
memory_limit setting in php.ini.
--
Edit bug report at http://bugs.php.net/?id=25093&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25093&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25093&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25093&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25093&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25093&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25093&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25093&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25093&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25093&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25093&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25093&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25093&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25093&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25093&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25093&r=gnused