none
Memory Leak in VSTO 2010 Excel document level customization RRS feed

  • Question

  • Hi,

    We have an issue with the memory leak with Excel 2010 - VSTO application. This customization talks to COM components through interops.

    Please note than whenever the memory usage of the Excel.exe reaches 900 MB there is an "Assertion.Falied" error.

    Similar application in Excel 2003 (VBA) uses COM component and also crashes when the threshold value of 900 MB is reached.

    But the spike in memory for Excel 2010 is more (note that this customization has WPF controls embedded in it) compared to Excel 2003, i.e. Excel 2010 reaches the threshold value faster compared to Excel 2003.

    Is there a problem or is this a normal behavior as far as memory consumption of Excel 2010 is concerned.

    Please suggest.

    Best Regards

    Thursday, February 2, 2012 12:04 PM

All replies

  • Hi Arnav,

    I haven't encountered the exact error you are referring to, however I have faced "OutOfMemoryException" quite a few times. We started using

    Marshal.FinalReleaseComObject(dataRangeToBeValidated);

    to statement to release COM object references, that did reduce the issue somewhat. We still face the OOM exception when populating large data for a pivot but it happens intermitently and happens when there are number of other applications or excels hogging the memory.

    One more thing that helped us reduce the initial memory consumption was to reduce static formatting in the excel and set format dynamically through code.

    I hope this information helps you somewhat.

    Avinash.


    Thanks, Avinash Nigam.
    Friday, February 3, 2012 1:34 AM
  • Hi Avinash,

     

    Thanks for your reply.

     

    Note that we are releasing the COM object references everywhere. But still the memory leak takes place. Also the formatting is not static.

    Am using the resolution given @ http://msdn.microsoft.com/en-us/magazine/cc163491.aspx

    Will post if I find a resolution.

    Best regards

    Friday, February 3, 2012 10:24 AM