Out of memory exceptions

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

Out of memory exceptions
Add-in Express Regions - Outlook 
Subscribe
Andy W




Posts: 8
Joined: 2017-09-27
Hi Alexander,

This crash occurs on various configuration's, but I reproduce it on Windows 10, Outlook 2016 - 32 Bit (Version 1708), my machine has an i7 processor, 16GB of RAM.

One of the easiest ways we reproduce this is by using an inspector with the following options:
InspectorItem = new ADXOlFormsCollectionItem
            {
                InspectorLayout = ADXOlInspectorLayout.CompleteReplacement,
                InspectorItemTypes = ADXOlInspectorItemTypes.olMail,
                InspectorMode = ADXOlInspectorMode.Read,
                Splitter = ADXOlSplitterBehavior.None,
                IsHiddenStateAllowed = false,
                IsMinimizedStateAllowed = false,
                FormClassName = typeof(AdxInspector).FullName,
                Cached = ADXOlCachingStrategy.OneInstanceForAllFolders
            };


And by selecting multiple MailItem's at once (e.g. 10) and clicking enter to open them all simultaneously.
It may take multiple efforts of opening and closing but without fail, it will happen.

Unfortunately, we tried to recreate this in a simple add-in which updated a label on form show but it doesn't seem to occur.
We are using an ElementHost, hosting a WPF control with various grid layouts, icons and text etc. But no loading of images or anything really, observing TaskManager and Outlook's details, with about 15 inspectors open, there's about 1600 GDI objects, and 3000 User objects, which doesn't seem too bad.

We're struggling to see how we could be causing this and again, we seem to get the red X at the WinForms level which only holds the ElementHost and WpfControl, and the error seems to throw at the AddinExpress level:
WndProc: Out of memory.: at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
at AddinExpress.Extensions.ADXContainerControl.PaintTo(Graphics dc, Int32 X, Int32 Y)
at AddinExpress.Extensions.ADXContainerControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at AddinExpress.Extensions.ADXContainerControl.WndProc(Message& m)
Regions Unhandled Error [System.OutOfMemoryException: Out of memory.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
at AddinExpress.Extensions.ADXContainerControl.PaintTo(Graphics dc, Int32 X, Int32 Y)
at AddinExpress.Extensions.ADXContainerControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at AddinExpress.Extensions.ADXContainerControl.WndProc(Message& m)]
Out of memory.:
WndProc: Out of memory.: at System.Drawing.Image.FromHbitmap(IntPtr hbitmap, IntPtr hpalette)
at System.Drawing.Image.FromHbitmap(IntPtr hbitmap)
at AddinExpress.Extensions.CompatibleBitmap.Update(Int32 width, Int32 height)
at AddinExpress.Extensions.CompatibleBitmap..ctor(IntPtr handle, Int32 width, Int32 height)
at AddinExpress.Extensions.ADXContainerControl.PaintBitmap(Int32 AWidth, Int32 AHeight)
at AddinExpress.Extensions.ADXContainerControl.PaintTo(Graphics dc, Int32 X, Int32 Y)
at AddinExpress.Extensions.ADXContainerControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at AddinExpress.Extensions.ADXContainerControl.WndProc(Message& m)
Regions Unhandled Error [System.OutOfMemoryException: Out of memory.
at System.Drawing.Image.FromHbitmap(IntPtr hbitmap, IntPtr hpalette)
at System.Drawing.Image.FromHbitmap(IntPtr hbitmap)
at AddinExpress.Extensions.CompatibleBitmap.Update(Int32 width, Int32 height)
at AddinExpress.Extensions.CompatibleBitmap..ctor(IntPtr handle, Int32 width, Int32 height)
at AddinExpress.Extensions.ADXContainerControl.PaintBitmap(Int32 AWidth, Int32 AHeight)
at AddinExpress.Extensions.ADXContainerControl.PaintTo(Graphics dc, Int32 X, Int32 Y)
at AddinExpress.Extensions.ADXContainerControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at AddinExpress.Extensions.ADXContainerControl.WndProc(Message& m)]

Any help would be greatly appreciated,
Thanks.
Posted 23 Oct, 2017 06:14:08 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello Andy,

We would like to access your PC remotely, reproduce the issue and debug your code. Is this possible? If yes, I suggest using TeamViewer; in this case you'll need to send us your session ID and password to the support email address; find it in {Add-in Express installation folder}\readme.txt. Please make sure your email contains a link to this topic.

Today we will be available for a remote within next 2.5 hrs.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 23 Oct, 2017 07:47:58 Top