From:             chris dot neale at somerfield dot co dot uk
Operating system: Winnt SP6a Build 1381
PHP version:      5CVS-2003-09-10 (dev)
PHP Bug Type:     ODBC related
Bug description:  Iterative calls to ODBC_DO seems to cause memory leak.

Description:
------------
I am trying to generate 700 static HTML pages each containing a table of
data. The loop appends the SQL string with the loop value and then calls
ODBC_DO. I've taken out all the table formatting routines out of the code
below, but it still replicates the same fault.

ODBC connects to an Access 97 SR1 database. I have installed the Jet SP
7_9NT service pack too.

When I run it, PHP.exe shows up in task manager's process monitor, eating
away at memory fast - about 1 meg every second gets consumed by php's
process and it generates about 7000 page faults every second too. But the
script still works, and the information comes out as expected. The memory
is then freed when PHP exits.

I'm concerned this bug will cause problems when I scale the project up to
generate 20000 + reports.

I've run this code not only from a web page, but also from the command
line with some additional code which waits for a user keystroke before
continuing to the next loop iteration, hoping to slow down the process.
The same problem occurred.

I'm using the latest Win32 CVS snapshot at the time of writing.

Same problem when using latest stable build of PHP 4.

php.ini - memory_limit = 8M

I've seen the memory climb as high as 40mb when running this script.

PHP.ini modifications:

extension=php_gd2.dll enabled.
doc_root, extension_dir

That's about all the info I can find... Really hope someone can shed some
light on this one as I've been trying to solve it for about 2 weeks! Many
thanks,

Chris

Reproduce code:
---------------
$dbCon = odbc_connect('AccessDbSystemDSN', '', '');

for ($nval=1;$nval<=700;$nval++)
{
$query = "SELECT * from [tablename] where ID = ".$nval;
$results = odbc_do($dbCon, $query);
}

odbc_close($dbCon); 



Expected result:
----------------
I expected the memory to remain fairly constant throughout execution, but
it keeps on rising and not always at a constant rate.



Actual result:
--------------
The reports generates successfully on my desktop machine despite the
memory rising, however PHP crashes when I run it on my laptop which has
less RAM than my desktop.

Same NT build and PHP CVS snapshot on Laptop. No error message, just
'Internal Server Error' message. No Apache error log generated.

-- 
Edit bug report at http://bugs.php.net/?id=25472&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25472&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25472&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25472&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25472&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25472&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25472&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25472&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25472&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25472&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25472&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25472&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25472&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25472&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25472&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25472&r=gnused

Reply via email to