|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-06-01 07:00 UTC] s dot boganov at kochmedia dot com
The function odbc_free_result() is not return memory.
Example:
<?php
$db = odbc_connect ("XX", "XXXXXX", "XXXXX");
for( $i=0; $i<1000;$i++) {
$q = odbc_do ($db, "SELECT titel FROM produkte WHERE prid=68340");
odbc_free_result( $q );
}
odbc_close( $db );
?>
httpd take ~100MB memory for this operation.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 17:00:01 2025 UTC |
I developed small application with WWW and DB2. After finished my work, I see - httpd crash after 2 hours works with diagnostic - 'no more memory'. I try to find this bugs in your 'Bugs database' and find recomendation upgrade to php 4.0.5 After this upgrade, all works fine - memory is free after execute command 'odbc_close', but memory isn't free after 'odbc_free_result' Look to the code 'php_odbc.c'. Probably, function 'odbc_free_result' will contain code like this: if (result->values) { for(i = 0; i < result->numcols; i++) { if (result->values[i].value) efree(result->values[i].value); } efree(result->values); result->values = NULL; } ( this code from 'odbc_next_result' function ) but I don't see any code like this .... Anyway, command 'top' show very high memory use, and my test program use ~100MB for operation, but as it describe in documentation my test programm will use a littlr bit memory....will you please test this patch on your version of PHP? it will require you to update to the 4.0.6 RC branch of PHP though.... it basically implements what you've suggested. Index: php_odbc.c =================================================================== RCS file: /repository/php4/ext/odbc/php_odbc.c,v retrieving revision 1.84.2.2 diff -u -r1.84.2.2 php_odbc.c --- php_odbc.c 2001/06/01 05:02:32 1.84.2.2 +++ php_odbc.c 2001/06/05 17:57:19 @@ -1871,6 +1871,16 @@ } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); + if (result->values) { + for (i = 0; i < result->numcols; i++) { + if (result->values[i].value) { + efree(result->values[i].value); + } + } + efree(result->values); + result->values = NULL; + } + zend_list_delete(result->id); RETURN_TRUE;