|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2000-07-24 12:48 UTC] hholzgra at cvs dot php dot net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 12:00:01 2025 UTC | 
After running a script which queries a MySQL database about 6000+ times in rapid succession, the apache daemon hogs upto 30-40Mb ram and doesn't release it, even though I use mysql_free_results() straight after queries have been performed. Is this a PHP bug? or a Solaris problem...? If you have an ideas I'd like to know for future reference etc. <?php >>> This following SQL query holds about 6000+ results 21 if (!$results_link_ids = mysql_db_query($db_name, "SELECT link_id FROM links ORDER by name", $db_connection)) { 22 error($PHP_SELF, "Failed link_id lookup"); 23 } 24 while ($row = mysql_fetch_array($results_link_ids)) { 25 if (!$results_count = mysql_db_query($db_name, "SELECT COUNT(*) AS count FROM catmap WHERE link_id = $row[link_id]", $db_connection)) { 26 error($PHP_SELF, "Failed count lookup"); 27 } 28 if (!mysql_result($results_count, 0, "count")) { 29 mysql_free_result($results_count); 30 if (!$results_link_details = mysql_db_query($db_name, "SELECT name, description, url FROM links WHERE link_id = $row[link_id]", $db_connection)) { 31 error($PHP_SELF, "Failed link details lookup"); 32 } 33 $link_details = mysql_fetch_array($results_link_details); 34 mysql_free_result($results_link_details); 35 print "<li><b><a href=\"$link_details[url]\" target=\"_new\">$link_details[name]</a></b><br>"; 36 print "<font size=\"-2\">"; 37 print "$link_details[url]<br>"; 38 print nl2br($link_details[description])."<br>"; 39 print "<br></font>"; 40 ++$unlink_count; 41 } 42 } 43 if (!$unlink_count) { 44 print "<center><b>There are no unlinked links</b></center>"; 45 } 46 else { 47 mysql_free_result($results_link_ids); 48 } 49 ?>