I dunno whether it's the php memory management's problem, the phplib's problem, or my coding's problem. Apparently, I'm facing a memory leak's problem that has no solution at all until now. Please help if someone faced the same situation before.
Given, a Mysql database, php 3.06, and apache running on Linux platform. For normal script, it works fine. But not when i have a huge data to process, and the script needs to run a couple of hours.
When i use "top" to monitor the process in Linux, the httpd is running extremely wierd. The memory usage is kept on increasing without stopping. My server is 256M of memory space.
My script is pretty long. What i did is briefly explain below:
$q="select * from HugeTable";
$DB->query($q);
$Data = array();
while ( $DB->next_record() )
{
$Data = $DB->Record;
// Process $Data from here
// Not much arrays were used, mainly for
// temporary storage.
// One loop takes about 2-8 secs
// In total, 20,000 of records.
}
Does anyone see any problem with the code above? I'm lost, please HELP!