Memory leak

Topics: Developer Forum
Jul 18, 2014 at 11:48 AM
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('memory_limit', '1024M');

ini_set('include_path', ini_get('include_path').';./Classes/');

include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel5.php';

$objReader = PHPExcel_IOFactory::createReader("Excel5");
$objReader->setReadDataOnly(true);


for ($i=0;$i<15000;$i++) {
        print "Iteration: ".$i.". Memory use now: ".round(memory_get_usage(true)/1024/1024, 3).' mb'."\n";
        
        $objPHPExcel = $objReader->load("empty.xls");
        $objPHPExcel->disconnectWorksheets();
        unset($objPHPExcel);
}
Version PHPExcel - 1.8.0
PHP - 5.5.10 (cli) - windows 7

Each iteration increases the memory usage. How to release memory?