PDA

View Full Version : Memory Leak


kwa1975
07-13-2006, 09:07 AM
In search_function.php about lines 277-284, one can read:
else {
$num_exclude[$n] = $num_res_temp;
while (list($spider_id,$weight) = mysql_fetch_array($result)) {
$s_exclude[$n][$spider_id] = 1;
}
mysql_free_result($result);
}
}It appears the MySQL results are not freed up in every case. I believe the intended code was:else {
$num_exclude[$n] = $num_res_temp;
while (list($spider_id,$weight) = mysql_fetch_array($result)) {
$s_exclude[$n][$spider_id] = 1;
}
}
mysql_free_result($result);
}In fact, I wonder why the MySQL result is not freed a bit later, about lines 284-290:
elseif (!isset($exclude[$n])) {
$num_res[$n] = 0;
$s_weight[$n][0] = 0;
}
mysql_free_result($result);
$timer->stop('spider fills');
}That memory leak might make some searches fail on some huge spider and sites databases.