Login OutOfMemoryException

Nov 26, 2009 at 9:04 AM

Hi, my friend
Thumbs UpWorks Greatly! And i really profit from this thread!
Thanks for what you've done!

Wink I want to point some error, and wait for your reply!

ConfusedEvery time, when i input empty password and login for 24 times(exactly), it throw OutOfMemoryException!
And when i input non-empty incorrectly password and login for about 46 time(exactly), it also throw OutOfMemoryException!

So sure that memory leaks and maybe bitmap did't dispose!

Here are the details:

at Microsoft.AGL.Common.MISC.HandleAr()
at System.Drawing.Bitmap._Init()
at System.Drawing.Bitmap..ctor()
at Fluid.Controls.FluidPanel.EnsureDBuffer()
at Fluid.Controls.FluidPanel.OnPaint()
at Fluid.Controls.ControlContainer.PaintControlUnbuffered()
at Fluid.Controls.ControlContainer.PaintControl()
at Fluid.Controls.ControlContainer.PaintControls()
at Fluid.Controls.ControlContainer.OnPaint()
at Fluid.Controls.FluidPanel.OnPaint()
at Fluid.Controls.FluidHost.OnPaint()

at System.Windows.Forms.Control.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.WL.Update()
at System.Windows.Forms.Control.Update()
at Fluid.Controls.FluidHost.Fluid.Controls.IHost.Update()
at Fluid.Controls.FluidControl.Update()
at Fluid.Controls.FluidPanel.topAnimation_Started()
at Fluid.Classes.Animation.OnStarted()
at Fluid.Classes.Animation.Start()
at Fluid.Controls.FluidPanel.AnimateTop()
at Fluid.Controls.FluidPanel.Show()
at Fluid.Controls.MessageDialog.Show()
at Fluid.Controls.FluidPanel.ShowModal()
at Fluid.Controls.MessageDialog.Show()
at Fluid.Controls.MessageDialog.Show()
at PasswordSafe.LoginPanel.ShowIncorrectPasswordDialog()
at PasswordSafe.LoginPanel.OnEnter()
at PasswordSafe.LoginPanel.PerformEnter()
at PasswordSafe.LoginPanel.numPad_Enter()
at Fluid.Controls.NumericPad.OnEnter()
at Fluid.Controls.NumericPad.btn_Click()
at Fluid.Controls.FluidControl.PerformClick()
at Fludi.Controls.FluidButton.PerformClick()
at Fluid.Controls.FluidControl.OnClick()
at Fluid.Controls.FluidButton.OnClick()
at Fluid.Controls.ControlContainer.OnClick()
at Fluid.Controls.ControlContainer.OnClick()
at Fluid.Controls.ControlContainer.OnClick()
at Fluid.Controls.ControlContainer.OnClick()
at Fluid.Controls.FluidHost.OnMouseUp()

at System.Windows.Forms.Control.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at PasswordSafe.Program.Main()

Jan 9, 2010 at 10:03 AM

I believe this has to do with the memory management of the .NET CF. I have read somewhere that it always uses continuous memory blocks for allocation. I guess after the 24 attemps it does not find a continuous block of the needed size any more even though it probably exists.

What resolution does your device have? I have one with 480x800 and there the problem can sometimes happen with the very first try depending on what else was done before that used up memory.


P.S. I could of course also be completely wrong :)

May 26, 2010 at 2:01 PM

Did you find a solution? I'm having the same problem after showing and hinding MessageDialog. My device has also the resolution 480x800

Jun 1, 2010 at 5:33 PM


I'm profiling Fluid for 2 weeks now to locate memory leaks (I had also too lot of memory exception on several devices with several screen resolutions) and found several leaks. I think I managed to solve almost all leaks, but I'll continue watching.

You're right Listen it doesn't dispose controls and bitmaps.

Today it's too late for me to do it, but I'll try tomorrow to build a patch to address most of the memory leaks I encountered (some of them are in controls I built on top of Fluid or modified to much and which I can't release for now as I didn't have to cleanup the code first [see my previous patch in the patches section of the source code page]).


Best regards,


Jun 7, 2010 at 11:15 AM

Hi sandson,

thanks for your answer. When will you post your changes?

Best regards



Jun 7, 2010 at 4:09 PM

Hi Sandson,

I've also encountered the same problems. I'd really greatly appreciate your help!

Thx in advance!


Jun 10, 2010 at 3:04 PM

The fix I've found for the ShowModal is to make sure the modalBackground object is disposed in the HideModalBackground method on the FluidPanel class.

I've also changed the ShowModal method itself to only instantiate the modalBackground object if it is null, otherwise reuse the one that is there - I've created a FluidComboBox which reuses a popup panel to allow selection of an item.

I'd really appreciate you sharing the other fixes you've found Sandson, will save me from having to do it myself :)


Jun 15, 2010 at 8:17 AM


Sorry men/women for my late answer. I created the patch but I'm faced to some issues with the Passwordsafe application. It crashes now with my patched Fluid assembly (all issues arise at the end of application, i.e. the application uses disposed controls).  I try to solve them and then I upload the patch.


dbcabc, I didn't changed the modalBackground behaviour but instead ensured that all references to controls are correctly disposed thus even if panels are instantiated several time they don't leak. Although your solution is good in terms of performance gain as allocating memory takes time but for now I didn't studied memory performance issues.


Best regards

Jul 19, 2010 at 2:21 PM
Hi, I finally managed to release the patch. You can find it in the patches section of this site (#6353). Best regards,