欢迎光临 高端调试
登录
|
注册
|
FAQ
搜索论坛
内核调试
ACPI调试
Linux内核调试
Windows内核调试
调试方法学
调试战役
调试原理
新工具观察
操作系统
Linux
Windows Vista
Windows
驱动开发
Linux驱动
WDF
WDM
总线
PCI Express
PCI/PCI-X
USB
无线通信协议
中央处理器
64位CPU
ARM
IA-32
CPU Info Center
计算机机系统
ACPI标准
系统认证
Desktop
服务器
嵌入式系统
Embedded Linux
嵌入式开发工具
VxWorks
WinCE
嵌入式Windows
特别链接
格蠹调试套件(GDK)
格蠹学院
小朱书店
老雷的微博
《软件调试》
《格蠹汇编》
《软件调试(第二版)》
沪ICP备11027180号-1
C/C++本地代码调试
帖子发起人:
Alex.xu
发起时间:
2009-07-23 13:38 下午
回复:
1
高端调试
»
软件调试
»
C/C++本地代码调试
»
Re: 关于内存泄漏的一个问题。哪位大侠帮我解疑?
搜索论坛
帖子排序:
Oldest to newest
Newest to oldest
2009-07-23, 13:38 下午
Alex.xu
注册: 2009-07-23
发 贴: 21
关于内存泄漏的一个问题。哪位大侠帮我解疑?
问题如下:程序运行一段时间后,进程虚拟内存达到2G的上限。 我现在需要分析出来内存的分布情况。就是说哪些组件或者线程占用了较大的内存。
>!address
-------------------- Usage SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Pct(Busy) Usage
3f04a000 ( 1032488) : 49.23% 52.57% : RegionUsageIsVAD
81c5000 ( 132884) : 06.34% 00.00% : RegionUsageFree
eef8000 ( 244704) : 11.67% 12.46% : RegionUsageImage
6e00000 ( 112640) : 05.37% 05.73% : RegionUsageStack
6e000 ( 440) : 00.02% 00.02% : RegionUsageTeb
2307a000 ( 573928) : 27.37% 29.22% : RegionUsageHeap
0 ( 0) : 00.00% 00.00% : RegionUsagePageHeap
1000 ( 4) : 00.00% 00.00% : RegionUsagePeb
0 ( 0) : 00.00% 00.00% : RegionUsageProcessParametrs
0 ( 0) : 00.00% 00.00% : RegionUsageEnvironmentBlock
Tot: 7fff0000 (2097088 KB) Busy: 77e2b000 (1964204 KB)
-------------------- Type SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Usage
81c5000 ( 132884) : 06.34% :
f1ac000 ( 247472) : 11.80% : MEM_IMAGE
47e3000 ( 73612) : 03.51% : MEM_MAPPED
6449c000 ( 1643120) : 78.35% : MEM_PRIVATE
-------------------- State SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Usage
6c672000 ( 1776072) : 84.69% : MEM_COMMIT
81c5000 ( 132884) : 06.34% : MEM_FREE
b7b9000 ( 188132) : 08.97% : MEM_RESERVE
明显可以看到 mem_commit + mem_reserve占用了总内存的 92%。
接着分析heap信息
0:084> !heap -s
LFH Key : 0x0d3db197
Termination on corruption : DISABLED
Heap Flags Reserv Commit Virt Free List UCR Virt Lock Fast
(k) (k) (k) (k) length blocks cont. heap
-----------------------------------------------------------------------------
Virtual block: 190b0000 - 190b0000 (size 00000000)
Virtual block: 4a170000 - 4a170000 (size 00000000)
Virtual block: 2a0e0000 - 2a0e0000 (size 00000000)
Virtual block: 2d120000 - 2d120000 (size 00000000)
Virtual block: 2f900000 - 2f900000 (size 00000000)
Virtual block: 25670000 - 25670000 (size 00000000)
006a0000 00000002 32576 24976 32576 2214 619 6 6 a LFH
00010000 00008000 64 12 64 10 1 1 0 0
Virtual block: 0ff00000 - 0ff00000 (size 00000000)
Virtual block: 10030000 - 10030000 (size 00000000)
Virtual block: 1bfb0000 - 1bfb0000 (size 00000000)
Virtual block: 1dda0000 - 1dda0000 (size 00000000)
Virtual block: 1ee30000 - 1ee30000 (size 00000000)
Virtual block: 21f30000 - 21f30000 (size 00000000)
00350000 00001002 3136 2176 3136 117 46 3 6 0 LFH
012b0000 00001002 1088 872 1088 5 10 2 0 0 LFH
Virtual block: 0c270000 - 0c270000 (size 00000000)
Virtual block: 16fe0000 - 16fe0000 (size 00000000)
Virtual block: 16f40000 - 16f40000 (size 00000000)
Virtual block: 17b80000 - 17b80000 (size 00000000)
Virtual block: 21490000 - 21490000 (size 00000000)
Virtual block: 21770000 - 21770000 (size 00000000)
Virtual block: 19fc0000 - 19fc0000 (size 00000000)
Virtual block: 16380000 - 16380000 (size 00000000)
Virtual block: 17c20000 - 17c20000 (size 00000000)
Virtual block: 2dea0000 - 2dea0000 (size 00000000)
Virtual block: 21bf0000 - 21bf0000 (size 00000000)
Virtual block: 22040000 - 22040000 (size 00000000)
Virtual block: 26240000 - 26240000 (size 00000000)
Virtual block: 2f4f0000 - 2f4f0000 (size 00000000)
Virtual block: 27a60000 - 27a60000 (size 00000000)
Virtual block: 28bd0000 - 28bd0000 (size 00000000)
Virtual block: 2fde0000 - 2fde0000 (size 00000000)
Virtual block: 300f0000 - 300f0000 (size 00000000)
Virtual block: 27c30000 - 27c30000 (size 00000000)
Virtual block: 33ca0000 - 33ca0000 (size 00000000)
Virtual block: 28760000 - 28760000 (size 00000000)
Virtual block: 30400000 - 30400000 (size 00000000)
Virtual block: 16190000 - 16190000 (size 00000000)
Virtual block: 1c980000 - 1c980000 (size 00000000)
Virtual block: 1d940000 - 1d940000 (size 00000000)
Virtual block: 141b0000 - 141b0000 (size 00000000)
Virtual block: 1da30000 - 1da30000 (size 00000000)
Virtual block: 206b0000 - 206b0000 (size 00000000)
Virtual block: 208e0000 - 208e0000 (size 00000000)
Virtual block: 211f0000 - 211f0000 (size 00000000)
Virtual block: 52070000 - 52070000 (size 00000000)
Virtual block: 54a60000 - 54a60000 (size 00000000)
Virtual block: 53280000 - 53280000 (size 00000000)
Virtual block: 55280000 - 55280000 (size 00000000)
Virtual block: 5b250000 - 5b250000 (size 00000000)
Virtual block: 5b660000 - 5b660000 (size 00000000)
Virtual block: 5b830000 - 5b830000 (size 00000000)
Virtual block: 5bb40000 - 5bb40000 (size 00000000)
Virtual block: 5cef0000 - 5cef0000 (size 00000000)
Virtual block: 5d200000 - 5d200000 (size 00000000)
Virtual block: 5d330000 - 5d330000 (size 00000000)
Virtual block: 5db30000 - 5db30000 (size 00000000)
Virtual block: 5df40000 - 5df40000 (size 00000000)
Virtual block: 5e110000 - 5e110000 (size 00000000)
Virtual block: 5e530000 - 5e530000 (size 00000000)
Virtual block: 5e830000 - 5e830000 (size 00000000)
Virtual block: 63370000 - 63370000 (size 00000000)
Virtual block: 66eb0000 - 66eb0000 (size 00000000)
Virtual block: 68780000 - 68780000 (size 00000000)
Virtual block: 7a260000 - 7a260000 (size 00000000)
Virtual block: 65020000 - 65020000 (size 00000000)
Virtual block: 6da00000 - 6da00000 (size 00000000)
Virtual block: 6e8d0000 - 6e8d0000 (size 00000000)
Virtual block: 734a0000 - 734a0000 (size 00000000)
Virtual block: 77ab0000 - 77ab0000 (size 00000000)
Virtual block: 63ee0000 - 63ee0000 (size 00000000)
Virtual block: 64360000 - 64360000 (size 00000000)
Virtual block: 64140000 - 64140000 (size 00000000)
Virtual block: 65ed0000 - 65ed0000 (size 00000000)
Virtual block: 661e0000 - 661e0000 (size 00000000)
Virtual block: 664f0000 - 664f0000 (size 00000000)
Virtual block: 66800000 - 66800000 (size 00000000)
Virtual block: 77dc0000 - 77dc0000 (size 00000000)
Virtual block: 66930000 - 66930000 (size 00000000)
Virtual block: 6e5b0000 - 6e5b0000 (size 00000000)
Virtual block: 66c30000 - 66c30000 (size 00000000)
Virtual block: 795a0000 - 795a0000 (size 00000000)
Virtual block: 78db0000 - 78db0000 (size 00000000)
Virtual block: 7b260000 - 7b260000 (size 00000000)
Virtual block: 785c0000 - 785c0000 (size 00000000)
Virtual block: 7ba50000 - 7ba50000 (size 00000000)
00330000 00001002 64000 57504 64000 569 587 29 71 8f LFH
013c0000 00001002 1088 176 1088 17 7 2 0 0 LFH
01550000 00041002 256 124 256 2 7 1 0 0 LFH
025b0000 00001002 64 4 64 2 1 1 0 0
027b0000 00001002 1088 184 1088 18 7 2 0 0 LFH
02970000 00001002 1024 1024 1024 1022 3 1 0 0
028c0000 00001002 1280 384 1280 5 22 2 0 0 LFH
03100000 00001002 3136 2492 3136 23 56 3 0 0 LFH
02960000 00001002 3136 2352 3136 327 45 3 0 0 LFH
External fragmentation 13 % (45 free blocks)
03a10000 00001002 256 28 256 2 1 1 0 0
03910000 00001002 1088 236 1088 61 6 2 0 0 LFH
04370000 00001001 64 40 64 2 1 1 0 bad
048e0000 00001002 1088 172 1088 29 12 2 0 0 LFH
04aa0000 00001002 1088 112 1088 3 5 2 0 0 LFH
07e70000 00001002 1024 1024 1024 1022 3 1 0 0
Virtual block: 0e700000 - 0e700000 (size 00000000)
Virtual block: 11180000 - 11180000 (size 00000000)
Virtual block: 2bdc0000 - 2bdc0000 (size 00000000)
Virtual block: 2cea0000 - 2cea0000 (size 00000000)
08490000 00001002 7232 4516 7232 372 38 4 4 0 LFH
08410000 00001002 15424 8904 15424 176 114 5 0 0 LFH
09480000 00011002 256 4 256 2 1 1 0 0
09020000 00001002 1088 340 1088 249 12 2 0 0 LFH
0d330000 00001002 1088 160 1088 6 4 2 0 0 LFH
129a0000 00001002 1088 108 1088 4 5 2 0 0 LFH
14170000 00001003 1280 1136 1280 1055 57 2 0 bad
External fragmentation 92 % (57 free blocks)
12b90000 00001003 256 4 256 2 1 1 0 bad
0a250000 00001003 256 4 256 2 1 1 0 bad
14130000 00001003 256 4 256 2 1 1 0 bad
14340000 00001003 256 4 256 2 1 1 0 bad
17d60000 00041002 256 112 256 1 16 1 0 0 LFH
Virtual block: 17da0000 - 17da0000 (size 00000000)
Virtual block: 1c7b0000 - 1c7b0000 (size 00000000)
Virtual block: 1cf60000 - 1cf60000 (size 00000000)
Virtual block: 1dd20000 - 1dd20000 (size 00000000)
Virtual block: 1e550000 - 1e550000 (size 00000000)
Virtual block: 1e840000 - 1e840000 (size 00000000)
Virtual block: 25c30000 - 25c30000 (size 00000000)
Virtual block: 344a0000 - 344a0000 (size 00000000)
Virtual block: 1f590000 - 1f590000 (size 00000000)
Virtual block: 20210000 - 20210000 (size 00000000)
Virtual block: 26030000 - 26030000 (size 00000000)
Virtual block: 2daa0000 - 2daa0000 (size 00000000)
Virtual block: 30700000 - 30700000 (size 00000000)
Virtual block: 32440000 - 32440000 (size 00000000)
Virtual block: 348a0000 - 348a0000 (size 00000000)
Virtual block: 34aa0000 - 34aa0000 (size 00000000)
Virtual block: 35b10000 - 35b10000 (size 00000000)
Virtual block: 213e0000 - 213e0000 (size 00000000)
Virtual block: 21960000 - 21960000 (size 00000000)
Virtual block: 34ea0000 - 34ea0000 (size 00000000)
Virtual block: 35f10000 - 35f10000 (size 00000000)
Virtual block: 36200000 - 36200000 (size 00000000)
Virtual block: 393d0000 - 393d0000 (size 00000000)
Virtual block: 395d0000 - 395d0000 (size 00000000)
Virtual block: 41ab0000 - 41ab0000 (size 00000000)
Virtual block: 438c0000 - 438c0000 (size 00000000)
Virtual block: 23010000 - 23010000 (size 00000000)
Virtual block: 230b0000 - 230b0000 (size 00000000)
Virtual block: 397d0000 - 397d0000 (size 00000000)
Virtual block: 41eb0000 - 41eb0000 (size 00000000)
Virtual block: 43cc0000 - 43cc0000 (size 00000000)
Virtual block: 43ec0000 - 43ec0000 (size 00000000)
Virtual block: 476d0000 - 476d0000 (size 00000000)
Virtual block: 478d0000 - 478d0000 (size 00000000)
Virtual block: 47cd0000 - 47cd0000 (size 00000000)
Virtual block: 24220000 - 24220000 (size 00000000)
Virtual block: 242c0000 - 242c0000 (size 00000000)
Virtual block: 4a960000 - 4a960000 (size 00000000)
Virtual block: 4ab60000 - 4ab60000 (size 00000000)
Virtual block: 4ad60000 - 4ad60000 (size 00000000)
Virtual block: 4c030000 - 4c030000 (size 00000000)
Virtual block: 4c230000 - 4c230000 (size 00000000)
Virtual block: 4c430000 - 4c430000 (size 00000000)
Virtual block: 4c830000 - 4c830000 (size 00000000)
Virtual block: 27390000 - 27390000 (size 00000000)
Virtual block: 27430000 - 27430000 (size 00000000)
Virtual block: 4cc30000 - 4cc30000 (size 00000000)
Virtual block: 4ce30000 - 4ce30000 (size 00000000)
Virtual block: 4d030000 - 4d030000 (size 00000000)
Virtual block: 4d230000 - 4d230000 (size 00000000)
Virtual block: 4d430000 - 4d430000 (size 00000000)
Virtual block: 4d630000 - 4d630000 (size 00000000)
Virtual block: 4da30000 - 4da30000 (size 00000000)
Virtual block: 28ee0000 - 28ee0000 (size 00000000)
Virtual block: 2f9f0000 - 2f9f0000 (size 00000000)
Virtual block: 4de30000 - 4de30000 (size 00000000)
Virtual block: 4e030000 - 4e030000 (size 00000000)
Virtual block: 4e230000 - 4e230000 (size 00000000)
Virtual block: 4e430000 - 4e430000 (size 00000000)
Virtual block: 4e630000 - 4e630000 (size 00000000)
Virtual block: 4e830000 - 4e830000 (size 00000000)
Virtual block: 4ec30000 - 4ec30000 (size 00000000)
Virtual block: 2fa90000 - 2fa90000 (size 00000000)
Virtual block: 2fb30000 - 2fb30000 (size 00000000)
Virtual block: 4f030000 - 4f030000 (size 00000000)
Virtual block: 4f230000 - 4f230000 (size 00000000)
Virtual block: 4f430000 - 4f430000 (size 00000000)
Virtual block: 4f630000 - 4f630000 (size 00000000)
Virtual block: 4f830000 - 4f830000 (size 00000000)
Virtual block: 4fa30000 - 4fa30000 (size 00000000)
Virtual block: 4fe30000 - 4fe30000 (size 00000000)
Virtual block: 30900000 - 30900000 (size 00000000)
Virtual block: 32640000 - 32640000 (size 00000000)
Virtual block: 50230000 - 50230000 (size 00000000)
Virtual block: 50430000 - 50430000 (size 00000000)
Virtual block: 50630000 - 50630000 (size 00000000)
Virtual block: 50830000 - 50830000 (size 00000000)
Virtual block: 50a30000 - 50a30000 (size 00000000)
Virtual block: 50c30000 - 50c30000 (size 00000000)
Virtual block: 23150000 - 23150000 (size 00000000)
Virtual block: 274d0000 - 274d0000 (size 00000000)
Virtual block: 28960000 - 28960000 (size 00000000)
Virtual block: 51d70000 - 51d70000 (size 00000000)
1c870000 00001002 7232 3300 7232 4 6 4 83 0 LFH
35280000 00001002 1088 440 1088 3 4 2 0 0 LFH
-----------------------------------------------------------------------------
上面的信息我就产生了两个疑问:
Virtual block: 51d70000 - 51d70000 (size 00000000) 这种信息到底代码什么意思?
因为我只知道:
006a0000 00000002 32576 24976 32576 2214 619 6 6 a LFH 代码一个堆的信息
我如果去掉这些所谓的Virtual block 信息。heap -s 信息精简为如下:
Heap Flags Reserv Commit Virt Free List U CR Virt Lock F ast
(k) (k) (k) (k) length bloc ks cont. heap
006a0000 2 32576 24976 32576 2214 619 6 6 a LFH
10000 8000 64 12 64 10 1 1 0 0
350000 1002 3136 2176 3136 117 46 3 6 0 LFH
012b0000 1002 1088 872 1088 5 10 2 0 0 LFH
330000 1002 64000 57504 64000 569 587 29 71 8f LFH
013c0000 1002 1088 176 1088 17 7 2 0 0 LFH
1550000 41002 256 124 256 2 7 1 0 0 LFH
025b0000 1002 64 4 64 2 1 1 0 0
027b0000 1002 1088 184 1088 18 7 2 0 0 LFH
2970000 1002 1024 1024 1024 1022 3 1 0 0
028c0000 1002 1280 384 1280 5 22 2 0 0 LFH
3100000 1002 3136 2492 3136 23 56 3 0 0 LFH
2960000 1002 3136 2352 3136 327 45 3 0 0 LFH
03a10000 1002 256 28 256 2 1 1 0 0
3910000 1002 1088 236 1088 61 6 2 0 0 LFH
4370000 1001 64 40 64 2 1 1 0 bad
4.80E+01 1002 1088 172 1088 29 12 2 0 0 LFH
04aa0000 1002 1088 112 1088 3 5 2 0 0 LFH
07e70000 1002 1024 1024 1024 1022 3 1 0 0
8490000 1002 7232 4516 7232 372 38 4 4 0 LFH
8410000 1002 15424 8904 15424 176 114 5 0 0 LFH
9480000 11002 256 4 256 2 1 1 0 0
9020000 1002 1088 340 1088 249 12 2 0 0 LFH
0d330000 1002 1088 160 1088 6 4 2 0 0 LFH
129a0000 1002 1088 108 1088 4 5 2 0 0 LFH
14170000 1003 1280 1136 1280 1055 57 2 0 bad
12b90000 1003 256 4 256 2 1 1 0 bad
0a250000 1003 256 4 256 2 1 1 0 bad
14130000 1003 256 4 256 2 1 1 0 bad
14340000 1003 256 4 256 2 1 1 0 bad
17d60000 41002 256 112 256 1 16 1 0 0 LFH
1c870000 1002 7232 3300 7232 4 6 4 83 0 LFH
35280000 1002 1088 440 1088 3 4 2 0 0 LFH
sum 总和: 153600 112928 153600
IP 地址: 已记录
报告
2009-07-23, 13:41 下午
Alex.xu
注册: 2009-07-23
发 贴: 21
Re: 关于内存泄漏的一个问题。哪位大侠帮我解疑?
接着看上面的东西: Reserv 的sum是153600kb Commit 的sum是112928 kb
与上面的!address 输出结果相差甚远
-------------------- State SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Usage
6c672000 ( 1776072) : 84.69% : MEM_COMMIT
81c5000 ( 132884) : 06.34% : MEM_FREE
b7b9000 ( 188132) : 08.97% : MEM_RESERVE
请问各位造成这种情况的原因是什么? !heap -s的信息感觉不全呢?
IP 地址: 已记录
报告
高端调试
»
软件调试
»
C/C++本地代码调试
»
Re: 关于内存泄漏的一个问题。哪位大侠帮我解疑?
请选择
论坛首页
|- 论坛搜索
|- 热门主题
|- 未回复的主题
用户选项
|- 登录
|- 注册
|- 找回密码
软件调试
|- Windows内核调试
|- C/C++本地代码调试
|- .Net程序调试
|- 脚本程序调试
|- Java程序调试
|- Linux内核调试
|- 《程序员》杂志调试专栏
|- WinDbg
|- GDB
|- 远程调试
|- 调试ACPI和BIOS
|- 特殊的调试任务
|- 转储分析
|- GDK7
内核探秘
|- Windows内核
|- Linux内核
系统架构
|- CPU架构
|- PCI/PCI Express架构
程序人生
|- 软件物语
|- 社区活动
|- 名人逸事
联盟论坛
|- 欢迎使用CnForums
没有银弹
|- BUG也精彩
|- 豆腐工程
|- 软件圈里十大怪
Windows Vista
|- 用调试利剑剖析VISTA内幕
|- 老专家如何破解新问题
|- 我的电脑谁说了算?
|- 资源
Office开发
|- Visio
驱动程序开发
|- Windows驱动开发
|- Linux驱动开发
|- Windows CE驱动开发
用户态开发
|- Windows本地代码(native)高级开发
|- Web应用开发
|- WinFX和.Net
|- Office开发
本站建设
|- 高端调试团队
|- 版面布局
|- 活动建议
|- 网站维护
64位计算
|- 64-bit Windows
|- 64-bit CPU
图书
|- 《软件调试》的示例程序
|- 《软件调试》的工具
|- 《软件调试》书友
|- 《软件调试》答疑
|- 《软件调试》勘误和意见
|- 《格蠹汇编》
|- 《软件调试》第二版卷1
|- 《软件调试》第二版卷2
云计算
|- IaaS
|- 云存储
|- 大数据
|- PaaS和SaaS
GPU
|- CUDA
|- OpenCL
|- HSA
|- 游戏开发与调试
(C)2004-2020 ADVDBG.ORG All Rights Reserved.