debug编译运行的时候怎么看不到任何有内存泄漏的提醒。用什么好工具可以,程序运行后感觉内存消耗得厉害,但又找不出原委。程序也做大了,人工查估计是没结果了

解决方案 »

  1.   

    强力推荐boundchecker  v6.01
    下载地址:
    http://www.vckbase.com/tools/debug/BChecker6.01.zip另外,在VC的输出窗口中(Output)里面有时也会有内存泄漏的信息
      

  2.   

    对于具体的函数,你还可以用CMemoryState来查看是否内存泄漏如:// example for CMemoryState::CMemoryState
    // Includes all CMemoryState functions
    CMemoryState msOld, msNew, msDif;
    msOld.Checkpoint();
    CAge* page1 = new CAge( 21 );
    CAge* page2 = new CAge( 22 );
    msOld.DumpAllObjectsSince();
    msNew.Checkpoint();
    msDif.Difference( msOld, msNew );
    msDif.DumpStatistics();The results from this program are as follows:Dumping objects ->
    {2} a CObject at $190A
    {1} a CObject at $18EA
    Object dump complete.
    0 bytes in 0 Free Blocks
    8 bytes in 2 Object Blocks
    0 bytes in 0 Non-Object Blocks
    Largest number used: 8 bytes
    Total allocations: 8 bytes
      

  3.   

    boundcheck比较牛,功能比较全
    DebugView比较小巧
      

  4.   

    我用的是 BoundsChecker 6.5