Discussion Locked

Random exception of OutOfMemory

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

While running my .NET application on Windows XP, randomly i get following exception - System.OutOfMemoryException: Failed to create a bitmap compatible with the screen to get information about screen bitmap format.
at System.Windows.Forms.DibGraphicsBufferManager.bFillBitmapInfo(IntPtr hdc, IntPtr hpal, BITMAPINFO_FLAT& pbmi)
at System.Windows.Forms.DibGraphicsBufferManager.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits)
at System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height)
at System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetBounds)
at System.Windows.Forms.DibGraphicsBufferManager.AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetBounds)
at System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(IntPtr target, Rectangle targetBounds)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at WeifenLuo.WinFormsUI.DockPaneStripBase.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Can anyone tell me why this error fires?

1 reply

by hal 9000

Your application is not clearing the RAM and is eating it up till you run out.

You can either rewrite the program to use far less RAM or clear it more often, or add more RAM id this is only being used on 1 computer.

Things like this are signs of bad coding practises but with anything written in .Net you really can not expect much better.

Col

This discussion is closed to new replies.