本文介绍了如何解决C ++中的内存泄漏问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的C ++ 6.0应用程序中存在内存泄漏,尽管我使用"LeakDiag"和"LDGragher"来检测内存泄漏,但无法解决它的泄漏.但是我找不到此泄漏的原因,我也已通过使用以下代码转储了内存:

I''m having a memory leak in my C++ 6.0 application, and I can''t fix it leak although I''m using "LeakDiag" and "LDGragher" to detect memory leak. But I can''t found the reason of this leak, also I had dumped memory by using this code:

define CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
_CrtDumpMemoryLeaks(); 



这给了我这个结果,我也无法捕捉到此泄漏的原因:



which gives me this result and also I can''t catch where is the reason of this leak:

Detected memory leaks! Dumping objects -> {994} normal block at 0x00DA55A0, 8 bytes long.  Data: <        > CD CD CD CD CD CD CD CD  {993} normal block at 0x00DA5558, 8 bytes long.  Data: <        > CD CD CD CD CD CD CD CD  {992} normal block at 0x00DA54C8, 8 bytes long.  Data: <        > CD CD CD CD CD CD CD CD  {987} normal block at 0x00DA5438, 12 bytes long.  Data: <            > CD CD CD CD CD CD CD CD CD CD CD CD  {982} normal block at 0x00DA5298, 12 bytes long.  Data: <    i       > B9 B9 B9 B9 69 06 00 00 01 00 CD CD  {978} normal block at 0x00DA5140, 12 bytes long.  Data: <    h       > B8 B8 B8 B8 68 06 00 00 01 00 CD CD  {972} normal block at 0x00DA4F48, 12 bytes long.  Data: <    g       > B7 B7 B7 B7 67 06 00 00 01 00 CD CD  {966} normal block at 0x00DA4D50, 12 bytes long.  Data: <    f       > B6 B6 B6 B6 66 06 00 00 01 00 CD CD  {960} normal block at 0x00DA4B58, 12 bytes long.  Data: <    e       > B5 B5 B5 B5 65 06 00 00 01 00 CD CD  {954} normal block at 0x00DA4960, 12 bytes long.  Data: <    d       > B4 B4 B4 B4 64 06 00 00 01 00 CD CD  {948} normal block at 0x00DA4768, 12 bytes long.  Data: <    c       > B3 B3 B3 B3 63 06 00 00 01 00 CD CD  {942} normal block at 0x00DA4570, 12 bytes long.  Data: <    b       > B2 B2 B2 B2 62 06 00 00 01 00 CD CD  {936} normal block at 0x00DA4378, 12 bytes long.  Data: <    a       > B1 B1 B1 B1 61 06 00 00 01 00 CD CD  {930} normal block at 0x00DA4180, 12 bytes long.  Data: <    `       > B0 B0 B0 B0 60 06 00 00 01 00 CD CD  {924} normal block at 0x00DA3F80, 12 bytes long.  Data: <            > BF BF BF BF 1F 06 00 00 01 00 CD CD  {920} normal block at 0x00DA3E28, 12 bytes long.  Data: <:::::       > 3A 3A 3A 3A 3A 00 00 00 01 00 CD CD  {914} normal block at 0x00DA3C30, 12 bytes long.  Data: <)))))       > 29 29 29 29 29 00 00 00 01 00 CD CD  {910} normal block at 0x00DA3AD8, 12 bytes long.  Data: <(((((       > 28 28 28 28 28 00 00 00 01 00 CD CD  {904} normal block at 0x00DA38E0, 12 bytes long.  Data: <            > BB BB BB BB 1B 06 00 00 01 00 CD CD  {900} normal block at 0x00DA3788, 12 bytes long.  Data: <=== =       > 3D 3D 3D 05 3D 00 00 00 01 00 CD CD  {894} normal block at 0x00DA3590, 12 bytes long.  Data: <            > AC AC AC AC 0C 06 00 00 00 00 CD CD  {888} normal block at 0x00DA3398, 12 bytes long.  Data: <    !`      > C1 C1 C1 C1 21 60 00 00 00 00 CD CD  {882} normal block at 0x00DA31A0, 12 bytes long.  Data: <    &       > C6 F5 C6 C6 26 06 00 00 01 00 CD CD  {876} normal block at 0x00DA2FA8, 12 bytes long.  Data: <    $       > C4 C4 C4 C4 24 06 00 00 01 00 CD CD  {870} normal block at 0x00DA2DB0, 12 bytes long.  Data: <            > 9D 9E 9D 9E 02 06 00 00 01 00 CD CD  {864} normal block at 0x00DA2BB8, 12 bytes long.  Data: <            > 99 9A 99 9A 01 06 00 00 01 00 CD CD  {858} normal block at 0x00DA29C0, 12 bytes long.  Data: <            > 9D 9E 9D 9E 00 06 00 00 01 00 CD CD  {852} normal block at 0x00DA27C8, 12 bytes long.  Data: <    )       > C9 C9 C9 C9 29 06 00 00 01 00 CD CD  {846} normal block at 0x00DA25D0, 12 bytes long.  Data: <    I       > E9 F5 E9 F5 49 06 00 00 01 00 CD CD  {840} normal block at 0x00DA23D8, 12 bytes long.  Data: <    J       > FD F6 EA EA 4A 06 00 00 01 01 CD CD  {834} normal block at 0x00DA21E0, 12 bytes long.  Data: <    H       > E8 E8 E8 E8 48 06 00 00 01 00 CD CD  {828} normal block at 0x00DA1FE8, 12 bytes long.  Data: <    G       > F3 F3 E7 F4 47 06 00 00 01 01 CD CD  {822} normal block at 0x00DA1DF0, 12 bytes long.  Data: <    F       > F2 F2 E6 E6 46 06 00 00 01 01 CD CD  {816} normal block at 0x00DA1BF8, 12 bytes long.  Data: <    E       > EF EF E5 E5 45 06 00 00 01 01 CD CD  {810} normal block at 0x00DA1A00, 12 bytes long.  Data: <    D       > FB FB E4 E4 44 06 00 00 01 01 CD CD  {804} normal block at 0x00DA1808, 12 bytes long.  Data: <    C       > FC FC E3 E3 43 06 00 00 01 01 CD CD  {798} normal block at 0x00DA1610, 12 bytes long.  Data: <    B       > F8 F8 E2 E2 42 06 00 00 01 01 CD CD  {792} normal block at 0x00DA1418, 12 bytes long.  Data: <    A       > BA BA E1 E1 41 06 00 00 01 01 CD CD  {786} normal block at 0x00DA1220, 12 bytes long.  Data: <    :       > EE ED DA F7 3A 06 00 00 01 01 CD CD  {780} normal block at 0x00DA1028, 12 bytes long.  Data: <    9       > DF C5 D9 EC 39 06 00 00 01 01 CD CD  {774} normal block at 0x00DA0E30, 12 bytes long.  Data: <    8       > D8 D8 D8 D8 38 06 00 00 01 01 CD CD  {768} normal block at 0x00DA0C38, 12 bytes long.  Data: <    7       > D7 D7 D7 D7 37 06 00 00 01 01 CD CD  {762} normal block at 0x00DA0A40, 12 bytes long.  Data: <    6       > EB EB D6 D6 36 06 00 00 01 01 CD CD  {756} normal block at 0x00DA0848, 12 bytes long.  Data: <    5       > BE BE D5 D5 35 06 00 00 01 01 CD CD  {750} normal block at 0x00DA0650, 12 bytes long.  Data: <    4       > BD BD D4 D4 34 06 00 00 01 01 CD CD  {738} normal block at 0x00DA0260, 12 bytes long.  Data: <    2       > D2 D2 D2 D2 32 06 00 00 01 00 CD CD  {732} normal block at 0x00DA0068, 12 bytes long.  Data: <    1       > D1 D1 D1 D1 31 06 00 00 01 00 CD CD  {726} normal block at 0x00D9FE70, 12 bytes long.  Data: <    0       > D0 D0 D0 D0 30 06 00 00 01 00 CD CD  {720} normal block at 0x00D9FC78, 12 bytes long.  Data: <    /       > CF CF CF CF 2F 06 00 00 01 00 CD CD  {714} normal block at 0x00D9FA80, 12 bytes long.  Data: <    .       > AF AF CE CE 2E 06 00 00 01 01 CD CD  {708} normal block at 0x00D9F888, 12 bytes long.  Data: <    -       > AE AE CD CD 2D 06 00 00 01 01 CD CD  {702} normal block at 0x00D9F690, 12 bytes long.  Data: <    ,       > AD AD CC CC 2C 06 00 00 01 01 CD CD  {696} normal block at 0x00D9F498, 12 bytes long.  Data: <    +       > AB AB CB CB 2B 06 00 00 01 01 CD CD  {690} normal block at 0x00D9F2A0, 12 bytes long.  Data: <    *       > AA AA CA CA 2A 06 00 00 01 01 CD CD  {684} normal block at 0x00D9F0A8, 12 bytes long.  Data: <    (       > A9 A9 C8 C8 28 06 00 00 01 01 CD CD  {678} normal block at 0x00D93EB8, 12 bytes long.  Data: <    "       > C2 A2 C2 A8 22 06 00 00 01 00 CD CD  {672} normal block at 0x00D93CC0, 12 bytes long.  Data: <    %       > C7 A8 C7 A8 25 06 00 00 01 00 CD CD  {666} normal block at 0x00D9EEB0, 12 bytes long.  Data: <    #       > C3 A5 C3 A5 23 06 00 00 01 00 CD CD  {660} normal block at 0x00D9ECB8, 12 bytes long.  Data: <    ''       > C7 A8 C7 A8 27 06 00 00 01 00 CD CD  f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occcont.cpp(923) : {643} normal block at 0x00D921B8, 12 bytes long.  Data: <*           > 2A 0C 06 00 00 00 00 00 00 00 00 00  f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occcont.cpp(923) : {642} normal block at 0x00D92170, 12 bytes long.  Data: <,           > 2C 0C 05 00 00 00 00 00 00 00 00 00  



抱歉,我知道这个问题很无聊,但确实需要我的帮助.



Sorry, I know that this issue is very boring but realy I need your help.

推荐答案



抱歉,我知道这个问题很无聊,但确实需要您的帮助.



Sorry, I know that this issue is very boring but realy I need your help.


#ifdef _DEBUG
#define new DEBUG_NEW
#endif



谢谢



Thanks,


这篇关于如何解决C ++中的内存泄漏问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 06:08