deltalimagolf Posted June 3, 2004 Posted June 3, 2004 I've 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 there's 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 Quote
Administrators PlausiblyDamp Posted June 3, 2004 Administrators Posted June 3, 2004 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+ isn't my strong point :)) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
deltalimagolf Posted June 3, 2004 Author Posted June 3, 2004 Task manager doesn't show anything. If I use the space bar to clear the error I can continue drawing as if it never existed. Quote
deltalimagolf Posted June 3, 2004 Author Posted June 3, 2004 Wrote my own drawpath, works great Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.