Outlook - Removing AdxForm instances from memory

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

Outlook - Removing AdxForm instances from memory
 
Bart Vadala




Posts: 9
Joined: 2015-09-21
Hi,

we're developing an Outlook addin using Add-in Express and we've been running into some memory issues with users that keep Outlook open for days at a time.
One of the things that we discovered is that, when using an AdxOlForm object to create a custom inspector region in an email window (the one that's opened when you double-click an email), this object is not cleaned up when the window is closed. As I understand it, inspector forms should not be cached and, in any case, setting caching to ADXOlCachingStrategy.None doesn't seem to make a difference.
According to the memory profiler, the reference is held by a "formInstances" collection on ADXOlFormsCollectionItem objects. This class has methods to retrieve existing forms, but there doesn't seem to be any way to remove them. This means that memory usage goes up every time the user opens an email. Is there a way to clean up old forms?

This is a part of the InitializeComponent method in our addin class (inheriting from ADXAddinModule) that shows how the forms are set up:


this.FormsManager = new AddinExpress.OL.ADXOlFormsManager(this.components);
this.MailInspectorHostItem = new AddinExpress.OL.ADXOlFormsCollectionItem(this.components);
this.FormsManager.Items.Add(this.MailInspectorHostItem);

// 
// MailInspectorHostItem
// 
this.MailInspectorHostItem.FormClassName = "(our class derived from AdxOlForm)";
this.MailInspectorHostItem.InspectorItemTypes = AddinExpress.OL.ADXOlInspectorItemTypes.olMail;
this.MailInspectorHostItem.InspectorLayout = AddinExpress.OL.ADXOlInspectorLayout.BottomSubpane;
this.MailInspectorHostItem.IsHiddenStateAllowed = false;
this.MailInspectorHostItem.RegionBorder = AddinExpress.OL.ADXRegionBorderStyle.None;
this.MailInspectorHostItem.Splitter = AddinExpress.OL.ADXOlSplitterBehavior.None;
this.MailInspectorHostItem.UseOfficeThemeForBackground = true;


The form class only contains a single control and there is no relevant code on the form itself.

We're currently using Addin Express version 8.1.4350.2005 on .NET 4.5, testing with Office version 16.0.6965.2063.
Posted 21 Jul, 2016 23:54:55 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Bart,

In a couple of minutes I'll send you a download link for the assembly which fixes this issue for us. Please let me know if it fixes the issue for you.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jul, 2016 05:19:29 Top
Bart Vadala




Posts: 9
Joined: 2015-09-21
Thanks for the dll. We deployed it and double checked in Process Explorer that the new version is being loaded.

Unfortunately it doesn't seem to fix this problem for us. We also tried removing everything else from our addin except this one form that I posted earlier, still no difference. Is there anything else we can try?
Posted 26 Jul, 2016 00:44:39 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Bart,

This works for us; we've rechecked this. As soon as the inspector is closed the form is disposed: the methods Dispose() and DestroyHandle get called; you can check this yourself.

We suppose your add-in still uses the old assembly version. Please repeat the steps to make sure that you retrieve and use the new assembly version. Don't forget to unblock the archive.

Please use this code to check if the assembly version is correct:

MessageBox.Show(Assembly.GetAssembly(typeof(ADXOlFormsManager)).GetName().Version.ToString());


If you use the new version and the issue is reproducible, please send us a sample project reproducing the issue.


Andrei Smolin
Add-in Express Team Leader
Posted 26 Jul, 2016 03:12:20 Top