ashrafmhd09 / php-csv-parser

Automatically exported from code.google.com/p/php-csv-parser
0 stars 0 forks source link

Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 1000000 bytes) in /var/www/files/DataSource.php on line 2149 #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Parsing a csv file with more than 1000 records

What is the expected output? 

Expected output was parsing the entire csv file, modifying data and import
to MySQL database.

What do you see instead?

Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to
allocate 1000000 bytes) in /var/www/files/DataSource.php on line 2149

What version of the product are you using? On what operating system?

File_CSV_DataSource-1.0.1.tgz

Please provide any additional information below.

Original issue reported on code.google.com by skh...@gmail.com on 29 Mar 2010 at 2:04

GoogleCodeExporter commented 9 years ago
I was running through the same problem. This happens when a script reaches the 
memory
limit established by php.ini. (By default PHP 5.2.10 limit i 8MB).

I solved the problem by adding the following line to override the php.ini limit
ini_set("memory_limit","128M");

Still, I noticed that the class uses a huge amount of memory to parse a file 
that is
not so big. For instance, my CSV file is has 15584 rows and it's size is 2.7MB 
and I
had to set the memory limit to at least 120MB in order to be able to process 
it...
that's a lot to me.

Original comment by david....@gmail.com on 3 May 2010 at 12:53