Memory is not released when removing sheetview

Posted by: krishna.vajja on 11 August 2021, 9:01 pm EST

  • Posted 11 August 2021, 9:01 pm EST - Updated 30 September 2022, 4:17 am EST

    Hello,

    We are using FpSpread with multiple Sheetview(at least 100), each SheetView might contain a lot of data and different cell types as well. When a SheetView gets removed from the FpSpread I would assume that the memory used by it gets released. I know that garbage collection kicks in at random times but in my case it never gets released.

    I tried multiple ways like

    Sheets.RemoveAt(i);

    pSheetView.Dispose();

    pSheetView = null;

    Also, I tried clearing the rows and columns and then ran dispose methods but, nothing worked.

    We also ran the performance profiler and saw that workbook styles and stylestorage objects are taking huge memory and it is not getting released.

    Hence with this issue, we can’t able to perform major functionalities in our applications and creating a negative impact on customers. It will be great if you fix this as soon as possible.

    Shared the performance profiler result, please have a look.

    Regards,

    Krishna.

  • Posted 15 August 2021, 6:22 pm EST

    Hi Krishna,

    Can you please confirm if the memory is still not released if you manually invoke the GC.

    You can try this when removing the sheet:

    Sheets.RemoveAt(i);
    pSheetView.Dispose();
    pSheetView = null;
    GC.Collect();
    

    Regards,

    Jitender

  • Posted 19 August 2021, 11:05 pm EST - Updated 30 September 2022, 4:17 am EST

    Hello Jitender,

    I even tried by explicitly giving the garbage ‘collect’ as suggested in the trail message, even then the result is the same.

    I need a couple of clarifications here,

    1. Is there any other way to dispose the whole FPspread with all the sheetview inside at once.
    2. While removing the each sheetview, why the sheetstylestorage and workbook sheetstyle storage still present in memory.

    I even thought for a while whether my system doesn’t have enought memory to handle, but I think we have sophisticated configuration with 32Gb RAM.

    Below is the point where exactly we are getting the issue,

  • Posted 22 August 2021, 3:43 pm EST

    Hi,

    We discussed this issue with the developers. Here are the responses/suggestions:

    1. Is there any other way to dispose the whole FPspread with all the sheetview inside at once.

      You can invoke FpSpread.Dispose(). However, you won’t be able to use the control anymore.

      Another way is to invoke FpSpread.Reset() to re-initialize all Spread data.

    While removing the each sheetview, why the sheetstylestorage and workbook sheetstyle storage still present in memory.

    There are many scenarios that the objects are kept in the memory. It’s hard for me to say the exact reason without any code to reproduce the issue. Here are some major scenarios in actual application

    1. Spread doesn’t release objects well
    2. Application has variables in a custom class which refers to FpSpread, SheetView…
    3. Objects are released but they will be kept in the memory until GC collects
    4. Objects are too big that GC places them in LOH (Large Object Heap). In this case, although objects are released, they’re still in memory until that memory of LOH are requested for another LOH

    If the issue belongs to #1, it’s bug of Spread.

    If the issue belongs to #2, it’s bug of application.

    If the issue belongs to #3, #4, it is not a bug.

    If you can reproduce this issue in a sample application and attach it here we would be able to further investigate it and identify the cause for this.

    Thanks,

    Jitender

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels