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. Using MemoryLeak detection in MFC

Using MemoryLeak detection in MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++performancehelp
4 Posts 4 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.
  • A Offline
    A Offline
    Anu_Bala
    wrote on last edited by
    #1

    Hi, When i search over the google about Memory leaks.I came to know about this commands.Then i use it in my code.

    _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
    _CrtMemState s1, s2, s3;
    _CrtMemDumpStatistics( &s1 );

    After closing my application i found this in output window But i cannot understand whats it saying. Pls help me whether this is a serious concern i have to look out. In Output window i got this

    2439008 bytes in 2147348480 Free Blocks.
    1244712 bytes in 2438992 Normal Blocks.
    2089871648 bytes in -16711681 CRT Blocks.
    2089919440 bytes in 2010977956 Ignore Blocks.
    -1 bytes in 1244308 Client Blocks.
    Largest number used: 2089919435 bytes.
    Total allocations: 2089918906 bytes.

    Anu

    C R R 3 Replies Last reply
    0
    • A Anu_Bala

      Hi, When i search over the google about Memory leaks.I came to know about this commands.Then i use it in my code.

      _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
      _CrtMemState s1, s2, s3;
      _CrtMemDumpStatistics( &s1 );

      After closing my application i found this in output window But i cannot understand whats it saying. Pls help me whether this is a serious concern i have to look out. In Output window i got this

      2439008 bytes in 2147348480 Free Blocks.
      1244712 bytes in 2438992 Normal Blocks.
      2089871648 bytes in -16711681 CRT Blocks.
      2089919440 bytes in 2010977956 Ignore Blocks.
      -1 bytes in 1244308 Client Blocks.
      Largest number used: 2089919435 bytes.
      Total allocations: 2089918906 bytes.

      Anu

      C Offline
      C Offline
      Chandrasekharan P
      wrote on last edited by
      #2

      Why not use the CMemoryState Class to find the memory leak?? It gives you a better understanding.

      1 Reply Last reply
      0
      • A Anu_Bala

        Hi, When i search over the google about Memory leaks.I came to know about this commands.Then i use it in my code.

        _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
        _CrtMemState s1, s2, s3;
        _CrtMemDumpStatistics( &s1 );

        After closing my application i found this in output window But i cannot understand whats it saying. Pls help me whether this is a serious concern i have to look out. In Output window i got this

        2439008 bytes in 2147348480 Free Blocks.
        1244712 bytes in 2438992 Normal Blocks.
        2089871648 bytes in -16711681 CRT Blocks.
        2089919440 bytes in 2010977956 Ignore Blocks.
        -1 bytes in 1244308 Client Blocks.
        Largest number used: 2089919435 bytes.
        Total allocations: 2089918906 bytes.

        Anu

        R Offline
        R Offline
        Rick York
        wrote on last edited by
        #3

        Those are the memory dump statistics that you asked for. You really only need the _CrtSetDbgFlag() call in your CWinApp-derived class constructor and it will do the leak detection for you. Also remember to define new as DEBUG_NEW for debug builds in all source modules.

        1 Reply Last reply
        0
        • A Anu_Bala

          Hi, When i search over the google about Memory leaks.I came to know about this commands.Then i use it in my code.

          _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
          _CrtMemState s1, s2, s3;
          _CrtMemDumpStatistics( &s1 );

          After closing my application i found this in output window But i cannot understand whats it saying. Pls help me whether this is a serious concern i have to look out. In Output window i got this

          2439008 bytes in 2147348480 Free Blocks.
          1244712 bytes in 2438992 Normal Blocks.
          2089871648 bytes in -16711681 CRT Blocks.
          2089919440 bytes in 2010977956 Ignore Blocks.
          -1 bytes in 1244308 Client Blocks.
          Largest number used: 2089919435 bytes.
          Total allocations: 2089918906 bytes.

          Anu

          R Offline
          R Offline
          Rolf Kristensen
          wrote on last edited by
          #4

          I recommend that you use Visual Leak Detector - Enhanced Memory Leak Detection for Visual C++[^] for detecting memory leaks.

          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