|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-10-07 06:33 UTC] gko at gko dot net
I need to generate some reports and I need to have some table's data as a whole as some columns of a row in this table and other tables reference other rows of this table. The PHP version is 4.0.4pl1, Apache is 1.3.14, and Oracle 8.1.7.
So basically, I do this inside a function:
.
.
.
while (ora_fetch($cursor)) {
$key = ora_getcolumn($cursor, 0);
for ($j=0; $j<ora_numcols($cursor); $j++) {
$col_name=ora_columnname($cursor, $j);
$col_value = ora_getcolumn($cursor,$j);
$ret_array[$key][$col_name] = $col_value;
}
}
.
.
.
Here are my problems:
- after the end of the script execution, the CPU load (seen by top) goes up to 99.90% for several minutes (for 4000 entries of 20 columns, it lasts about 2 minutes); during the script execution and HTTP transfer, the CPU load is normal, once the file transfer is over, the load becomes 99.x %
- if I do this on a just started Apache, a lot of memory is consumed (normal) but not released:
Before:
nobody 10159 0.0 0.1 14.8M 2.3M ?? S 14:42:45 0:00.25 /www/bin/httpd
After
nobody 10159 99.9 0.7 42.7M 29M ?? R 14:42:45 0:36.23 /www/bin/httpd
^^^^ CPU ^^^^ ^^^^^RAM
- I did some experiements and observed this:
- if I do an exit in the returning function just before "return $ret_array", then the high CPU load does not occurs (I'm not sure about memory leak)
- if now I do an exit just after calling the function, then the high CPU load occurs (I'm not sure about memory leak). It looks like if $ret_array "moves" out of the function, a high CPU load occurs... I have tried with references, unset, etc... before/after calling the function to help the garbage collection at the end of the script but it doesn't help, I always have the high CPU load.
Do you have any idea of what's happening?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
I have compiled PHP 4.2.3 (was 4.0.4pl1) and tested my code: the high CPU load after code execution is no more there, but there is still memory leak: before: nobody 19621 0.0 0.0 14.3M 560K ?? S 16:32:09 0:00.00 /www/bin/httpd after: nobody 19621 0.0 0.9 50.3M 37M ?? S 16:32:09 0:33.91 /www/bin/httpd ^^^^^ ^^^ If I comment out "$retval[$key][$col_name]= $value", then I have: nobody 20871 0.0 0.0 14.8M 1.9M ?? S 17:24:49 0:00.03 /www/bin/httpd