php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40089 memory leak in fgetcsv
Submitted: 2007-01-10 13:29 UTC Modified: 2007-01-10 14:43 UTC
From: zibi at nora dot pl Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.0 OS: linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zibi at nora dot pl
New email:
PHP Version: OS:

 

 [2007-01-10 13:29 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-10 13:44 UTC] 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 14:43 UTC] zibi at nora dot pl
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC