Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. ReleaseDC doesn't release memory

ReleaseDC doesn't release memory

Scheduled Pinned Locked Moved Mobile
helpc++performancequestionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    k
    wrote on last edited by
    #1

    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

    E 1 Reply Last reply
    0
    • K k

      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

      E Offline
      E Offline
      eli15021979
      wrote on last edited by
      #2

      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

      K 1 Reply Last reply
      0
      • E eli15021979

        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

        K Offline
        K Offline
        k
        wrote on last edited by
        #3

        I already tryied but it doesn't change. Thank you anyway. I fixed the problem using handles instead of pointers for the dc, but I really don't understand why it happens.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups