Possible work around for OutOfMemoryException?

Add-in Express™ Support Service
That's what is more important than anything else

Possible work around for OutOfMemoryException?
 
EnterpriseDev


Guest


Hi team,

A swift reply would be highly appreciated.

In some cases we have seen users receiving System.OutOfMemoryException in Outlook. This happens infrequently (1/1000 users reporting it for a few out of several hundred customers) and seem to happen at random. It looks to be unrelated to our add-in as we are not doing any heavy processing and we are printing the memory usage as ~4 MB (with GC.GetTotalMemory(false)) when the exception happens.

We also got reported from our customer that the Large Address Aware (LAA) patch did help their specific case (https://support.office.com/en-us/article/Large-Address-Aware-in-Outlook-2016-ea0913e4-2917-4456-b0ea-935dbd57ef02). This specific customer mentioned that the memory error was unrelated to our add-in but rather that it was a result of Outlook running out of memory.

But this time we are receiving error logs of the same error from another customer even though their Outlook version is LAA aware as they have a later build of Outlook deployed.

Here is a link of trying to recover from this kind of memory issue:
https://stackoverflow.com/questions/4688348/call-gc-collect-before-throwing-outofmemoryexception?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

So the question is, do you have any idea how to deal with this exception? Would it be worth trying to recover by calling GC.Collect() and then running the add-in OnSend logic again? We understand that recovering this way might not be bullet proof but at least it might be worth a try.
Posted 28 May, 2018 04:40:31 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello,

That exception has its source and cause. If it doesn't relate to your add-in than you can prove this by turning your add-in off and reproducing the exception. I don't think the LAA update could solve such an issue.

I don't think the issue originates from Outlook itself.

Most probably, the exception is raised by one of the add-ins; unless proven to be clear, your add-in is under suspicion. To find out what add-in produces it, turn all the add-ins off and turn them on one by one.

You should get more information: I would look into system logs. If you identify the add-in that produces the issue, turn it off. If this is caused by your add-in, please provide more information.


Andrei Smolin
Add-in Express Team Leader
Posted 28 May, 2018 06:18:57 Top
EnterpriseDev


Guest


Thank you. But like explained this has happened about 4 times for a few users out of thousands users, and only for a few customers out of several hundred customers, and it happens very rarely and is not reproducible, and the memory footprint of the add-in is very small. Hence reproducing this in a reliable manner is is NOT possible. We have no option but to try to recover using GC.Collect().
Posted 28 May, 2018 06:27:31 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
It's okay to use GC.Collect(). You should be prepared however that this doesn't help if the issue originates from another add-in as GC.Collect() only applies to the memory your add-in uses.


Andrei Smolin
Add-in Express Team Leader
Posted 28 May, 2018 07:07:54 Top