Feedback

Open Workbook memory issues

Last post 05-16-2012, 7:26 PM by Shakeel Faiz. 10 replies.
Sort Posts: Previous Next
  •  05-02-2012, 8:46 AM 379806

    Open Workbook memory issues .NET

    Attachment: Present (inaccessible)
    Hi there,

    I think there's a issue regarding the memory release when opening a WorkBook in aspose.cells. The memory is never release (at least until other call is made to the service).

    In the project that I'm involved we manage several huge Excel files with aspose, and the memory in server is really a critical point.

    I already look in this foruns (google it as well) and I didn't find any solution.

    So, how can I close (dispose) the object Workbook after use?

    In attach you can find a sample (web) to demonstrate what I'm saying. 

    1) Open the solution and run
    2) Click "Button" (you will see the memory pointing to +/- 300MB..)
    3) When the loading stops the memory will remaing in +/- 300MB (shouldn't)
    4) Open several windows in browser, and, in all of them, call the function (in my office sample i opened 3 and the memory went to 1GB (no release)...

    It's true that if I call the same pages again (in the opened windows) the memory will remain the same but what we really want is to clear the object from RAM memory.

    Thanks in advance,




     
  •  05-02-2012, 9:33 AM 379826 in reply to 379806

    Re: Open Workbook memory issues

    Hi,

    I have checked your test project, the memory does go to 300 MB once the workbook is loaded.

    I have forwarded your issue to development team so that they could give you advice how to tackle the memory issue.

    Also, I have logged your issue in our database. Once, there is some update relating to it available, we will let you know asap.

    This issue has been logged as CELLSNET-40631.

    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Developer
    Aspose Support Team
    Aspose - Your File Format APIs

    Keep in touch! We're on Twitter and Facebook
     
  •  05-02-2012, 10:28 PM 379948 in reply to 379806

    Re: Open Workbook memory issues

    Hi,

    IIS only recycle resource when the memory exceeds limitation or time interval triggers

    Maybe you have to call GC by yourself ,see the following code:

    C#
    var directory = Server.MapPath("/Excel/validation.xlsm");
    var workGroup = new Workbook(directory);
    workGroup = null;
    GC.Collect();
    GC.WaitForPendingFinalizers();


    And we are working on reducing memory when loading file.
    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Developer
    Aspose Support Team
    Aspose - Your File Format APIs

    Keep in touch! We're on Twitter and Facebook
     
  •  05-03-2012, 4:18 AM 380045 in reply to 379948

    Re: Open Workbook memory issues .NET

    Attachment: Present (inaccessible)
    Hi,

    Actually the problem is nothing to do with Web Projects, despite what we need is that.

    In attach you will find a Windows Form Project which happens exactly the same thing.

    Try this:
    1) Run the project
    2) Hit the button "call aspose"
    3) hit the button 5 times in total (equal to my previous sample)

    You will see that memory will stay at 1GB, exactly the same problem as the previous web project.

    If you hit just one time the memory will be (and stay) at 300mb...

    So, I still think that it should have a Dispose, or Close, method on WorkBook Class (to close all open streams, or/and other variables that should be closed).


    Thanks in advance


     
  •  05-07-2012, 6:55 AM 380813 in reply to 380045

    Re: Open Workbook memory issues

    Hi!! 

    Is there any news about this issue?

    As I told before, this is nothing to do with web projects, and critical issue for our company.

    We bought Aspose 1 month ago, but regarding this issue, we are tied up.

    Thanks once again,
     
  •  05-07-2012, 10:27 AM 380879 in reply to 380813

    Re: Open Workbook memory issues

    Hi,

    As we mentioned in the above post that we are working on reducing memory when loading file.

    It could take some time, I guess, it could take couple of weeks.  Anyway, I have logged your comment in our database against the issue id: CELLSNET-40631

    Once, we have some update, we will get back to you.

    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Developer
    Aspose Support Team
    Aspose - Your File Format APIs

    Keep in touch! We're on Twitter and Facebook
     
  •  05-08-2012, 5:17 AM 381100 in reply to 380879

    Re: Open Workbook memory issues

    Hi,


    We are working on improving memory performance for reading template files with large dataset. However, it is a complicated task and we are afraid it cannot be completed soon. And we do not think your issue is related to reading one large template file. In fact your memory issue (according to your requirement about Dispose or Close method) should be caused by that one Workbook object has not been disposed when your program finished using it. As we have said, you should use code like:

    workGroup = null;

    GC.Collect();

    to let .Net dispose the resources definitely. By our test with your given project, after adding this code the memory used by the program is always about 300M when press “call” many times.

     

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Support Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  05-08-2012, 5:38 AM 381102 in reply to 381100

    Re: Open Workbook memory issues

    Hi, Thanks for your reply!

    We are already "disposing" the workbook using the "workGroup = null;", but no difference made, regarding memory.

    The use of GC.Collect is not an option for us. There are some issues regarding the use of the method, and causes other further issues.

    We will wait for your updates (dispose / close method for workbook), and when you have that we will change our code.

    Best regards,

     
  •  05-09-2012, 1:40 AM 381312 in reply to 381102

    Re: Open Workbook memory issues

    Hi,

    What do you think the Close()/Dispose() method can do in Workbook object? The memory is used by datamodel of the Workbook(just assume that you have created a byte array that uses 300M memory and want to dispose it). We do not think there is a better way to release the memory explicitly than using GC. Even if we provide such a method, we can do nothing in it than using GC to release the datamodel. How and when the resources will be released depends on .Net framework completely and may be different for different envoirnments. For this point we are afraid we can do nothing.
    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Developer
    Aspose Support Team
    Aspose - Your File Format APIs

    Keep in touch! We're on Twitter and Facebook
     
  •  05-09-2012, 4:02 AM 381366 in reply to 381312

    Re: Open Workbook memory issues

    Hi,

    I think that, in the Workbook, Aspose is not cleaning the open stream after use.. I think the Dispose() / Close() method shall close any streams which is currently open.

    I have some questions:
    1. All objects which Aspose open are .net managed?

    2. If not, you guarantee that all not .net managed objects are realeased?

    The use of GB.Collect shall not be used (only in unique situation or test... - don't think that is the case). 

    Garbage collection occurs when one of the following conditions is true:

    • The system has low physical memory.

    • The memory that is used by allocated objects on the managed heap surpasses an acceptable threshold. This means that a threshold of acceptable memory usage has been exceeded on the managed heap. This threshold is continuously adjusted as the process runs.

    The GC.Collect method is called. In almost all cases, you do not have to call this method, because the garbage collector runs continuously. This method is primarily used for unique situations and testing.

    Reference: http://msdn.microsoft.com/en-us/library/ee787088.aspx

     
  •  05-16-2012, 7:26 PM 383364 in reply to 381366

    Re: Open Workbook memory issues

    Hi,

    Yes, all objects of Aspose.Cells are .NET managed object.

    We do not use any unmanaged code.

    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Developer
    Aspose Support Team
    Aspose - Your File Format APIs

    Keep in touch! We're on Twitter and Facebook
     
View as RSS news feed in XML