#40089 [Bgs]: memory leak in fgetcsv

From: Date: Wed, 10 Jan 2007 14:43:03 +0000
Subject: #40089 [Bgs]: memory leak in fgetcsv
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107422@lists.php.net to get a copy of this message
ID: 40089 User updated by: zibi at nora dot pl Reported By: zibi at nora dot pl Status: Bogus Bug Type: Streams related Operating System: linux PHP Version: 5.2.0 New Comment: Yea, sure. Tell it to my scripts. After parsing more than 20MB csv files scripts are killed cause memory exchaustion (64MB). I tried to unset everything what is not used, but in every loop execution i loose few kilobytes. Previous Comments: ------------------------------------------------------------------------ [2007-01-10 13:44:39] tony2001@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The engine is expected to cache small memory chunks. All real memory leaks are reported on shutdown. ------------------------------------------------------------------------ [2007-01-10 13:29:33] zibi at nora dot pl Description: ------------ It looks like fgetcsv didn't free memory used for input buffer. Reproduce code: --------------- $f=fopen('file.csv','r'); $prev=memory_get_usage(); while($line=fgetcsv($f)) { unset($line); $now=memory_get_usage(); echo ($now-$prev); $prev=$now; } Expected result: ---------------- 0 0 0 0 0 0 0 0 0 or something oscilated around 0 Actual result: -------------- 2096 2088 2088 2088 2064 2072 2072 2072 2048 2092 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40089&edit=1

« previous php.bugs (#107422) next »