Memory Leak, context Device
-
Hi, How are you all? This is my first post here. I am new to MFC and just a college passout. I hope to have nice answers here for all the "Greats"! My program is having memory leakage. In my view function, I use
CDC *pdc=GetDC()
But I am not releasing it. Can this be a reason for leak? In view function what is the best method to use Contect devices to avoid such errors? Should CClientDC be used? I assume I am understandable here . -- LinDaSu -
Hi, How are you all? This is my first post here. I am new to MFC and just a college passout. I hope to have nice answers here for all the "Greats"! My program is having memory leakage. In my view function, I use
CDC *pdc=GetDC()
But I am not releasing it. Can this be a reason for leak? In view function what is the best method to use Contect devices to avoid such errors? Should CClientDC be used? I assume I am understandable here . -- LinDaSuHi What you have there is not a regular memory leak... it could be a GDI resource leak. But that is depending on how the window class is created. If any of the following styles were used CS_CLASSDC, CS_OWNDC or CS_PARENTDC, then the above is not a resource leak, other wise you should use ReleaseDC to reclaim the GDI resources. Also for you information, VS C++ will not report GDI resource leaks only normal memory leaks from the built in memory handler. Magnus