如何判断是托管内存泄漏还是本机内存泄漏?

发布于 2024-12-04 07:22:39 字数 2495 浏览 1 评论 0原文

我与本机 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ㄖ落Θ余辉 2024-12-11 07:22:39
395fe000 ( 940024) : 44.83% 54.41% : RegionUsageStack

避免同时运行一千个线程。

395fe000 ( 940024) : 44.83% 54.41% : RegionUsageStack

Avoid running a thousand threads at the same time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文