In my project, I have created around 12 custom controls(checkbox,radiobutton,editbox,progressbar,scrollbar,button etc...). Custom painting is done in all controls for the extended look and feel using Pen,Brushes,Graphics, GraphicPath,Images,Region and Bitmaps ect. After the use of these objects, I have disposed the objects using the Dispose() method. I am using these controls in a System.Windows Form. When I am contiously showing and closing the Form causes an increase in the GDI objecs each time. I have checked the GDI object count using Task Manager and confirmed the GDI leak in the form.
My question is, how can I manage this GDI leak?
How do I find which GDI object causes the leak eventhough I am disposing the GDI objects?
kaizen202
0
Newbie Poster
Recommended Answers
Jump to PostJust because you Disposed of an object doesn't mean the system has. Keep opening/closing the form and see if you run out of memory (you really do have a leak) or at some point all those GDI objects vanish (the GC ran and cleaned up for you).
All 3 Replies
Momerath
1,327
Nearly a Senior Poster
Featured Poster
kaizen202
0
Newbie Poster
kaizen202
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.