Reply to topic  [ 8 posts ] 
Problems with disposing of EasyXLS objects 
Author Message

Joined: Fri Jul 10, 2009 3:16 am
Posts: 4
Reply with quote
Post Problems with disposing of EasyXLS objects
Good day to everyone.

I am having dificulties using EasyXLS 6.1 in my C# projects. I would like you to provide an exact procedure for disposing memory of your ExcelDocument object. The problem which I encounter is quite simple as that I have a feeling that memory is not cleared after calling Dispose method of ExcelDocument object

What I mean is:
///////////////////////////////////////////////////////
ExcelDocument xls = new ExcelDocument();
xls.easy_LoadXLSFile( stream );

// doing something with ExcelDocument, ExcelTable, ExcelCell etc...

xls.Dispose()
////////////////////////////////////////////////////////

The memory is not cleared after the last line of code above.

Thanks in advance!


Fri Jul 10, 2009 3:34 am
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 189
Location: Brasov, Romania
Reply with quote
Post 
The memory is not clean each time when an object is disposed. .NET Framework uses an optimized algorithm for releasing memory. You may force the Garbage Collector to deallocate unused memory, using the System.GC.Collect() method. But this does not guarantee that the memory will be release for sure. If enough memory will be available, the memory will not be released at all.


Last edited by daniela on Fri Jul 10, 2009 6:52 am, edited 1 time in total.



Fri Jul 10, 2009 6:21 am
Profile WWW

Joined: Fri Jul 10, 2009 3:16 am
Posts: 4
Reply with quote
Post 
Daniela wrote:
The memory is not clean each time when an object is disposed. .NET Framework uses an optimized algorithm for releasing memory. You may force the Garbage Collector to deallocate unused memory, using the System.GC() method. But this does not guarantee that the memory will be release for sure. If enough memory will be available, the memory will not be released at all.


Thanks for a quick answer!

I understand all this perfectly well. I tried to call GC.Collect() explicitly but memory was not cleared. The real reason I asked this question is an exception trown by .net claiming "Out of memory" after loading 36M excel file. I would like to hear your suggestion on the issue.


Fri Jul 10, 2009 6:33 am
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 189
Location: Brasov, Romania
Reply with quote
Post 
This depends on your computer performances. Your file is very big and it consumes at lot of memory when loading and more memory when writing, if this is the case.
Here is a post that contains one of our big volume tests :
http://forum.easyxls.com/viewtopic.php?t=1074


Fri Jul 10, 2009 6:56 am
Profile WWW

Joined: Fri Jul 10, 2009 3:16 am
Posts: 4
Reply with quote
Post 
Daniela wrote:
This depends on your computer performances. Your file is very big and it consumes at lot of memory when loading and more memory when writing, if this is the case.
Here is a post that contains one of our big volume tests :
http://forum.easyxls.com/viewtopic.php?t=1074


Thank you for information.
As I wrote above I would like you to provide an exact procedure for disposing memory of your ExcelDocument object. We really need it to make absolutely sure that we dispose all EasyXLS objects correctly.


Mon Jul 27, 2009 5:14 am
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 189
Location: Brasov, Romania
Reply with quote
Post 
The only thing you can do is calling the System.GC.Collect() method.


Tue Jul 28, 2009 4:25 am
Profile WWW

Joined: Fri Jul 10, 2009 3:16 am
Posts: 4
Reply with quote
Post 
Daniela wrote:
The only thing you can do is calling the System.GC.Collect() method.


Thank you for a quick response.
As far as I understand you the desired procedure for disposing memory of all EasyXLS objects should be a simple one like this:

/////////////////////////////////////////////////////////////////////
ExcelDocument xls = new ExcelDocument();

// Doing something with ExcelDocument, ExcelTable, ExcelCell

xls.Dispose();
System.GC.Collect();
/////////////////////////////////////////////////////////////////////

Am I right?


Wed Jul 29, 2009 7:32 am
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 189
Location: Brasov, Romania
Reply with quote
Post 
Right


Wed Jul 29, 2009 7:34 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.