PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   Bug Tracker (http://www.phpdig.net/forum/forumdisplay.php?f=27)
-   -   Memory Leak (http://www.phpdig.net/forum/showthread.php?t=2512)

kwa1975 07-13-2006 08:07 AM

Memory Leak
 
In search_function.php about lines 277-284, one can read:
Code:

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:
Code:

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:
Code:

      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.


All times are GMT -8. The time now is 05:43 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.