VC 问题 怎么回事啊,我在程序中用了Carray<>

[复制链接]
查看11 | 回复3 | 2010-10-12 08:38:49 | 显示全部楼层 |阅读模式
Detected memory leaks!
Dumping objects ->
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202167} normal block at 0x0F55C8E8, 96 bytes long.
Data:52 C5 7C 1F 44 16 7C 41 81 48 7E 7C 65 69 54 41
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202166} normal block at 0x0F554F90, 20 bytes long.
Data:E8 AF B6 01 E8 C8 55 0F 04 00 00 00 04 00 00 00
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202162} normal block at 0x0F55C348, 96 bytes long.
Data:52 C5 7C 1F 44 16 7C 41 81 48 7E 7C 65 69 54 41
d:\vss\vc.net\vc.net版\gv3dalgorithms\gv3dbsp.cpp(683) : {202161} normal block at 0x0F55C708, 96 bytes long.
Data:52 C5 7C 1F 44 16 7C 41 81 48 7E 7C 65 69 54 41
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202152} normal block at 0x0F55C668, 96 bytes long.
Data:2C 69 47 7D 45 16 7C 41 22 39 0B 33 65 69 54 41
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202151} normal block at 0x0F54A290, 20 bytes long.
Data:E8 AF B6 01 68 C6 55 0F 04 00 00 00 04 00 00 00
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202147} normal block at 0x0F55C2A8, 96 bytes long.
Data:2C 69 47 7D 45 16 7C 41 22 39 0B 33 65 69 54 41
d:\vss\vc.net\vc.net版\gv3dalgorithms\gv3dbsp.cpp(683) : {202146} normal block at 0x0F55C150, 96 bytes long.
Data:2C 69 47 7D 45 16 7C 41 22 39 0B 33 65 69 54 41
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202130} normal block at 0x0F55C0C8, 72 bytes long.
Data:F2 D0 ED D5 45 16 7C 41 45 43 A4 75 65 69 54 41
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202129} normal block at 0x0F552FD0, 20 bytes long.
Data:E8 AF B6 01 C8 C0 55 0F 03 00 00 00 03 00 00 00
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(406) : {202125} normal block at 0x0F54E180, 72 bytes long.
Data:F2 D0 ED D5 45 16 7C 41 45 43 A4 75 65 69 54 41
d:\vss\vc.net\vc.net版\gv3dalgorithms\gv3dbsp.cpp(683) : {202124} normal block at 0x0F554EF0, 96 bytes long.
Data:F2 D0 ED D5 45 16 7C 41 45 43 A4 75 65 69 54 41
怎么回事啊,我在程序中用了Carray
解决了可继续追加分

回复

使用道具 举报

千问 | 2010-10-12 08:38:49 | 显示全部楼层
内存泄露。自己 new 的内存要自己用 delete 释放。CArray 实质是一个管理数组的类,如果你用这个类来管理指针类型的数据,它并不负责对你存入的指针进行释放,它只释放它自己占用的内存。在 RemoveAt 时,你要先释放该元素指向的内存再 RemoveAt,RemoveAll也一样,你要先 GetCount 再一个一个地释放。如果你用 CArray 来管理的不是指针类型数据,那有可能是其它的原因,这需要看到你的代码才知道。
回复

使用道具 举报

千问 | 2010-10-12 08:38:49 | 显示全部楼层
有内存泄露,需要释放内存的位置必须释放才行
回复

使用道具 举报

千问 | 2010-10-12 08:38:49 | 显示全部楼层
变量类型不对。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行