OutOfMemoryException called DrawPath

deltalimagolf

New member
Joined
Apr 30, 2004
Messages
4
Ive got a PictureBox where the end user can draw rectangles, lines,
ellipses and freehand on an image. Everything works fine, except for an
occasional OutOfMemoryException. It only occurs when drawing freehand and
theres already a figure (StartFigure is called again), the first line is
added to the figure and DrawPath is called. The exception occurs (only
occasionally) when the call is made to DrawPath. It only happens when the
pen width >= 2. I can get around the exception by leaving the mouse over
the image with the left button pressed down, and pressing the space bar to
clear the exception.

Dave
 
If you run task manager (or better still Process Explorer) does the memory usage increase steadily or is it a single increase that causes this problem?
Also are you correctly disposing all the GDI+ objects you are creating in your drawing code? If in doubt please post the relevant code and somebody may be able to spot a problem (GDI+ isnt my strong point :))
 
Task manager doesnt show anything. If I use the space bar to clear the error I can continue drawing as if it never existed.
 
Back
Top