如何判断是托管内存泄漏还是本机内存泄漏?
我与本机 dll 互操作的 .NET 进程抛出 OutOfMemory 异常。以下是 !address -summary 和 --eeheap-gc 辅助命令的输出。这是否意味着它是托管泄漏还是本机泄漏?
0:000> !address -summary
ProcessParametrs 002f10a8 in range 002f0000 003f0000
Environment 002f07f0 in range 002f0000 003f0000
-------------------- Usage SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Pct(Busy) Usage
17773000 ( 384460) : 18.33% 22.25% : RegionUsageIsVAD
168aa000 ( 369320) : 17.61% 00.00% : RegionUsageFree
110fe000 ( 279544) : 13.33% 16.18% : RegionUsageImage
395fe000 ( 940024) : 44.83% 54.41% : RegionUsageStack
396000 ( 3672) : 00.18% 00.21% : RegionUsageTeb
7540000 ( 120064) : 05.73% 06.95% : 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: 69746000 (1727768 KB)
-------------------- Type SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Usage
168aa000 ( 369320) : 17.61% : <free>
15970000 ( 353728) : 16.87% : MEM_IMAGE
47e9000 ( 73636) : 03.51% : MEM_MAPPED
4f5ed000 ( 1300404) : 62.01% : MEM_PRIVATE
-------------------- State SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Usage
303e1000 ( 790404) : 37.69% : MEM_COMMIT
168aa000 ( 369320) : 17.61% : MEM_FREE
39365000 ( 937364) : 44.70% : MEM_RESERVE
Largest free region: Base 0d8b1000 - Size 0010f000 (1084 KB)
0:000> !EEHeap -gc
Number of GC Heaps: 1
generation 0 starts at 0x425f776c
generation 1 starts at 0x425f5a08
generation 2 starts at 0x01881000
ephemeral segment allocation context: none
segment begin allocated size
01880000 01881000 0281ecf8 0x00f9dcf8(16375032)
12010000 12011000 12f83a04 0x00f72a04(16198148)
1e0a0000 1e0a1000 1e734094 0x00693094(6893716)
41e80000 41e81000 427048d0 0x008838d0(8927440)
Large object heap starts at 0x02881000
segment begin allocated size
02880000 02881000 02a36958 0x001b5958(1792344)
13010000 13011000 137c0020 0x007af020(8056864)
Total Size 0x378b9d8(58243544)
------------------------------
GC Heap Size 0x378b9d8(58243544)
My .NET process that interops with native dlls is throwing an OutOfMemory Exception. Following is out put of !address -summary and --eeheap-gc coammands. Does this mean if its a managed leak or native leak?
0:000> !address -summary
ProcessParametrs 002f10a8 in range 002f0000 003f0000
Environment 002f07f0 in range 002f0000 003f0000
-------------------- Usage SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Pct(Busy) Usage
17773000 ( 384460) : 18.33% 22.25% : RegionUsageIsVAD
168aa000 ( 369320) : 17.61% 00.00% : RegionUsageFree
110fe000 ( 279544) : 13.33% 16.18% : RegionUsageImage
395fe000 ( 940024) : 44.83% 54.41% : RegionUsageStack
396000 ( 3672) : 00.18% 00.21% : RegionUsageTeb
7540000 ( 120064) : 05.73% 06.95% : 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: 69746000 (1727768 KB)
-------------------- Type SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Usage
168aa000 ( 369320) : 17.61% : <free>
15970000 ( 353728) : 16.87% : MEM_IMAGE
47e9000 ( 73636) : 03.51% : MEM_MAPPED
4f5ed000 ( 1300404) : 62.01% : MEM_PRIVATE
-------------------- State SUMMARY --------------------------
TotSize ( KB) Pct(Tots) Usage
303e1000 ( 790404) : 37.69% : MEM_COMMIT
168aa000 ( 369320) : 17.61% : MEM_FREE
39365000 ( 937364) : 44.70% : MEM_RESERVE
Largest free region: Base 0d8b1000 - Size 0010f000 (1084 KB)
0:000> !EEHeap -gc
Number of GC Heaps: 1
generation 0 starts at 0x425f776c
generation 1 starts at 0x425f5a08
generation 2 starts at 0x01881000
ephemeral segment allocation context: none
segment begin allocated size
01880000 01881000 0281ecf8 0x00f9dcf8(16375032)
12010000 12011000 12f83a04 0x00f72a04(16198148)
1e0a0000 1e0a1000 1e734094 0x00693094(6893716)
41e80000 41e81000 427048d0 0x008838d0(8927440)
Large object heap starts at 0x02881000
segment begin allocated size
02880000 02881000 02a36958 0x001b5958(1792344)
13010000 13011000 137c0020 0x007af020(8056864)
Total Size 0x378b9d8(58243544)
------------------------------
GC Heap Size 0x378b9d8(58243544)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
避免同时运行一千个线程。
Avoid running a thousand threads at the same time.