ReleaseDC doesn't release memory
-
I had problems using GetDC and ReleaseDC, so I built a blank MFC app like this:
BOOL CTestdcDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CenterWindow(GetDesktopWindow()); // center to the hpc screen // TODO: Add extra initialization here **SetTimer(1,200,NULL);** return TRUE; // return TRUE unless you set the focus to a control } void CTestdcDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CDC *myDC; switch(nIDEvent) { case 1: **myDC=GetDC(); ReleaseDC(myDC);** break; } CDialog::OnTimer(nIDEvent); }
The memory used by this application increases continuously. What am I missing? This issue is causing me a lot of problems, do you ever encountered a problem like this? Thanks, Keraam -
I had problems using GetDC and ReleaseDC, so I built a blank MFC app like this:
BOOL CTestdcDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CenterWindow(GetDesktopWindow()); // center to the hpc screen // TODO: Add extra initialization here **SetTimer(1,200,NULL);** return TRUE; // return TRUE unless you set the focus to a control } void CTestdcDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CDC *myDC; switch(nIDEvent) { case 1: **myDC=GetDC(); ReleaseDC(myDC);** break; } CDialog::OnTimer(nIDEvent); }
The memory used by this application increases continuously. What am I missing? This issue is causing me a lot of problems, do you ever encountered a problem like this? Thanks, KeraamHi, I don't really see the problem,but try to change the timer interval(i don't think that GetDC() and ReleaseDC() takes more than 200msec,but maybe it's the problem). Good luck Eli
-
Hi, I don't really see the problem,but try to change the timer interval(i don't think that GetDC() and ReleaseDC() takes more than 200msec,but maybe it's the problem). Good luck Eli