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. General Programming
  3. C / C++ / MFC
  4. Memory Leak, context Device

Memory Leak, context Device

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++performance
2 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.
  • L Offline
    L Offline
    LinDaSu
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • L 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 . -- LinDaSu

      M Offline
      M Offline
      Magnus Westin
      wrote on last edited by
      #2

      Hi 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

      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