script seize memory in while loop

From: Date: Wed, 04 Aug 2004 09:01:36 +0000
Subject: script seize memory in while loop
Groups: php.general 
Request: Send a blank email to php-general+get-192678@lists.php.net to get a copy of this message
Hello i have a class to import files i read in a file (size 30 MB) line by line in the first example memory usage ist the same class myimp { function myimp() function Start() { fp = fopen (...) while ($buffer = fgets(fp, 500)) { // here i can check the data nothing wrong memory is the same unset ($buffer); } fclose(fp) } } this works fine and consume during the loop always (nearly the same depends on $buffer) same memory if i add a simple function into the while loop the memory usage grows function _import_db($data) { $sql = "INSERT .... ". "VALUES ($data[1],$data[2])"; unset ($sql); } only the building of the string consumes more memory in every loop !? I don't know what to do BR/Torsten Rosenberger

« previous php.general (#192678) next »