GDI leak question.
Posted on 2009-05-08
I have an windows mobile app and i'm trying to track down why my app 'freezes' from time to time. It happens after many hours of use and I dont know why. I am going over every piece of code and inspecting it to see if I can find the problem.
In the OnPaint() of one of my dialogs I have the following code:
CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
dc.BitBlt(xPos, yPos, bi.bmWidth, bi.bmHeight, &bmDC, 0, 0, SRCCOPY);
I have found out that I should have the following two lines added in after the last line above:
I want to understand the effect of not having the above two lines. For example, some users may not use the dialog that this code in in often and others may use it more. So far I cannot reproduce the 'freezing' defect.
Is there a way I can debug the above code and see the effecs of any GDI leak over time. What variables should I be looking at? SHould I monitor 'private bytes' etc??