GDI+ and memory leaks
-
I have some custom drawing code that I'm doing in my application. I made sure to use the using statement or explicity call dispose on all the brushes and pens that I'm using to make sure that I don't have any memory leaks. My problem is that if I start the application and move the mouse around to cause the drawing to occur then I see in the task manager that I slowly eat up more and more memory, 20-60k at a time. If I don't change a single line of code but put in a GC.Collect() at the end of my drawing then I see that no extra memory is consumed. I've left the application running for a while and I don't see the memory being released w/o the GC.Collect(). Am I supposed to just trust that everything is going ok under the covers and that at some point Garbage collection will get it? If I do this and I give someone here my application won't they assume I have a memory leak? Thanks, Michael
-
I have some custom drawing code that I'm doing in my application. I made sure to use the using statement or explicity call dispose on all the brushes and pens that I'm using to make sure that I don't have any memory leaks. My problem is that if I start the application and move the mouse around to cause the drawing to occur then I see in the task manager that I slowly eat up more and more memory, 20-60k at a time. If I don't change a single line of code but put in a GC.Collect() at the end of my drawing then I see that no extra memory is consumed. I've left the application running for a while and I don't see the memory being released w/o the GC.Collect(). Am I supposed to just trust that everything is going ok under the covers and that at some point Garbage collection will get it? If I do this and I give someone here my application won't they assume I have a memory leak? Thanks, Michael
Am I supposed to just trust that everything is going ok under the covers and that at some point Garbage collection will get it? Yes, I suppose you do have to trust -- unless otherwise.... "...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..." Me
-
I have some custom drawing code that I'm doing in my application. I made sure to use the using statement or explicity call dispose on all the brushes and pens that I'm using to make sure that I don't have any memory leaks. My problem is that if I start the application and move the mouse around to cause the drawing to occur then I see in the task manager that I slowly eat up more and more memory, 20-60k at a time. If I don't change a single line of code but put in a GC.Collect() at the end of my drawing then I see that no extra memory is consumed. I've left the application running for a while and I don't see the memory being released w/o the GC.Collect(). Am I supposed to just trust that everything is going ok under the covers and that at some point Garbage collection will get it? If I do this and I give someone here my application won't they assume I have a memory leak? Thanks, Michael