disconnectWorksheets() not working?

Topics: User Forum
Nov 29, 2012 at 9:08 PM
Edited Nov 29, 2012 at 9:09 PM

Hi there,

I'm using the method "disconnectWorksheets()" and then unseting my $objPHPExcel var, and then checking the PHP memory and it seems not working to free PHP memory :-(

My code is something like this:

echo memory_get_usage(TRUE);

After unseting my var and checking memory I get the same amount of used memory, it seems disconnectWorksheets() + unset() doesn't free any memory at all... :-(

Any tip?

Thank you!

Nov 30, 2012 at 11:43 AM

PHP doesn't actually free up memory until the garbage collection runs.

If you're running PHP 5.3.0 or above, take a look at http://php.net/manual/en/features.gc.php for forcing garbage collection, otherwise PHP will free up the memory when it needs to reallocate it for some other object, or sometimes at a "quiet point" in code execution