The memory settings once again

Topics: User Forum
May 3, 2009 at 10:51 AM
Edited May 3, 2009 at 11:11 AM
Hi! =)

Very nice of you to contribute with PHPExcel,thank you.

I just want to understand how
ini_set("memory_limit","");
affects the server and RAM etc. If i using my own server (WAMP) and set the memory limity to something high like 2048mb (in both ini_set and php conf file) PHPExcel can convert a 18mb excel5 file to CSV. However the peak memory is ~900mb.

what can happend if i set the memory_limit so high ? i am the only one working against the server on localhost.

How come the peak memory is so high, is php leaking so much in these loops ??

is there any other trick to avoid using so much memory?

I use

ini_set("memory_limit","2048M");

echo date('H:i:s') . " Load from Excel5 file\n";

$objPHPExcel = new PHPExcel();
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$objReader->setReadDataOnly(TRUE);
$objPHPExcel = $objReader->load('input.xls');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
$objWriter->setDelimiter(';');
$objWriter->setEnclosure('');
$objWriter->save('example.csv');


Also, in my created csv the character gets strange. Is it UTF-8 as default ?
It doesn't seems to support Swedish å ä ö

Thanks!

Developer
May 3, 2009 at 1:03 PM
1. Can you try using latest source code from here and report back the results? (Some improvements have been done, but these are mainly related to styles.)
http://phpexcel.codeplex.com/SourceControl/ListDownloadableCommits.aspx

2. Yes, all strings are UTF-8 in PHPExcel, what character set do you need?

3. Can you can upload the Excel file somewhere and send me a link? (erik at phpexcel dot net). This will help us tuning the library for large-scale Excel files.