Open MikeGWem opened 8 years ago
This seems more like a case of the GarbageCollector not feeling like cleaning up (in a timely manner) rather than a memory leak, but i agree. any IDisposables that are short-lived should be wrapped in a using block ie: Pen, Brush, Bitmap, Graphics, GraphicsPath, StringFormat etc
I noticed that the process memory increased steadily in response to a click setting a Checkbox state to checked. That was substantially relieved by shifting the code in DrawCheckMarkBitmap() to the main onPaint() method and disposing of the graphics and bitmap objects - something like:
` var checkMark = new Bitmap(CHECKBOX_SIZE, CHECKBOX_SIZE); using (var gi = Graphics.FromImage(checkMark)) { // clear everything, transparent gi.Clear(Color.Transparent);
` However a small memory increase persists with continued clicking on a Checkbox. If I spot the source I will add to this.