zoukankan      html  css  js  c++  java
  • C++内存泄露的检测(二)

    使用MFC提供的功能来检测内存泄露。

    使用方法:

    1)工程是MFC工程,或是工程的设置中有Use MFC in a Shared DLL,
    2)很多地方说是要定义以下宏
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #endif
    但是我发现只要include <afx.h> 即可。(大家可以检测一下)
    3)可以在F5运行程序后,在output窗口中看到如下的内存泄露的显示。(只在debug下有用哦)
    4)如果有泄露,则显示如下:
    Detected memory leaks!
    Dumping objects ->
    {214} normal block at 0x00D91618, 4 bytes long.
     Data: <    > 00 00 00 00
    {208} normal block at 0x00D914D0, 4 bytes long.
     Data: <    > 00 00 00 00
    {207} normal block at 0x00D91490, 4 bytes long.
     Data: <    > D0 14 D9 00
    {205} normal block at 0x00D91410, 4 bytes long.
     Data: <    > 00 00 00 00
    {204} normal block at 0x003AFFD8, 4 bytes long.
     Data: <    > 10 14 D9 00
    {203} normal block at 0x003AFF98, 4 bytes long.
     Data: <    > 00 00 00 00
    {202} normal block at 0x003AFF58, 4 bytes long.
     Data: <  : > 98 FF 3A 00
    {200} normal block at 0x003AFF18, 4 bytes long.
     Data: <    > 00 00 00 00
    Object dump complete.

  • 相关阅读:
    全球市场
    去做《波士堂》的现场观众?
    JavaScript测试工具
    Opera 10 正式版发布
    [ZZ]亚马逊购物的用户体验分析
    中国电子商务十二年调查报告
    推荐——李黎的《轻公司》
    [ZZ]国外互联网发展趋势
    [ZZ]走出Google(下)
    空中英语教室
  • 原文地址:https://www.cnblogs.com/FCoding/p/2576876.html
Copyright © 2011-2022 走看看