General discussion


Random exception of OutOfMemory

By ombhutswaha ·
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?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by HAL 9000 Moderator In reply to Random exception of OutOf ...

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.


Related Discussions

Related Forums