.net - Out of Memory Exception at System.Drawing.Graphics.FromHdcInternal but no memory leak -
am getting occasional crash following trace:
system.outofmemoryexception: out of memory. @ system.drawing.graphics.fromhdcinternal(intptr hdc) @ system.windows.forms.painteventargs.get_graphics() @ system.windows.forms.control.paintbackcolor(painteventargs e, rectangle rectangle, color backcolor) @ system.windows.forms.control.paintbackground(painteventargs e, rectangle rectangle, color backcolor, point scrolloffset) @ system.windows.forms.control.paintbackground(painteventargs e, rectangle rectangle) @ system.windows.forms.control.onpaintbackground(painteventargs pevent) @ system.windows.forms.scrollablecontrol.onpaintbackground(painteventargs e) @ system.windows.forms.control.paintwitherrorhandling(painteventargs e, int16 layer, boolean disposeeventargs) @ system.windows.forms.control.wmerasebkgnd(message& m) @ system.windows.forms.control.wndproc(message& m) @ system.windows.forms.scrollablecontrol.wndproc(message& m) @ system.windows.forms.containercontrol.wndproc(message& m) @ system.windows.forms.usercontrol.wndproc(message& m) @ system.windows.forms.control.controlnativewindow.onmessage(message& m) @ system.windows.forms.control.controlnativewindow.wndproc(message& m) @ system.windows.forms.nativewindow.callback(intptr hwnd, int32 msg, intptr wparam, intptr lparam)
as can see theres none of code in trace i'm finding hard find cause. google searches seem inconclusive point gc handle leak somewhere following recent crash memory usage was:
handle count:16,283, private bytes:995,440k, virtual bytes:1,628,208k, working set:866,892k, gc heap size:158,841k, gdi objects:402, user objects:1,607
which not seem out of ordinary. also, regularly use .net memory profiler manage leaks.
unfortunately app quite large many windows first question be: how can identify window causing pain?
and of course second question be: if there no handle leak, causing exception!?
edit:
sorry can't post code: massive codebase , exceptions arent giving me clues part may problem.
i read there being 10,000 limit on handles app has historically run fine 15,000 assumed limit on else: gdi handles or user objects maybe?
just make sure, checked , handles not being leaked assigned @ startup , not increase usage.
let me modify question: given information, should next course of action be? have process explorer installed , have succeeded in getting full memory dump 1 of crashes dont have experience in using either diagnose kind of problem (until .net memory profiler has been enough)
you assigning brushes or pens , aren't disposing of them - consumes gdi handles , @ point, of them used , outofmemoryexception.
Comments
Post a Comment