如何解决.Net中的内存泄漏问题(Windows应用程序)
问题描述:
大家好,
我的应用程序在运行时遇到内存泄漏的问题.
该应用程序使用这样的CPU内存.
最低百分比为6%
最高百分比为35%
最大峰值内存为90MB
我已使用ANTS Memory Profiler分析应用程序中的内存泄漏.
但是我不知道如何在运行时减少应用程序的内存使用量.
请任何人可以尽快给我解决方案.
谢谢与问候
Ramesh N
Hi All,
I have a problem of memory leaks in my application when its running.
The Application Uses CPU Memory like this.
Minimum Percentage is 6%
Maximum Percentage is 35%
Maximum Peak Memory is 90MB
I have used ANTS Memory Profiler for Analyzing Memory Leaks in the Application.
But I don''t know how to reduce the memory usage of Application while running.
Please Any can give me solution as soon as possible.
Thanks and Regards
Ramesh N
答
好吧,您自己一个人,因为我们不能帮助您解决代码中的内存泄漏,没有它的副本.这取决于您和您使用调试器的能力.
您所能做的就是熟悉.Net应用程序中内存的使用方式(存在潜在问题的区域)并减轻它们.
一个问题领域是创建事件处理程序,然后不释放它们,或者在不处理它们的情况下创建位图或其他类似GDI的资源.
由于我们不了解您的神秘应用程序的功能,因此我们不能说去看看"或去看看".
至于不泄漏内存的情况,请尝试一次分配内容.重复的分配/取消分配会使内存碎片化,并且可以像内存泄漏一样完全停止应用程序.
Well, you''re pretty much on your own because we can''t possibly help you with memory leaks in your code because we don''t have a copy of it. It''s up to you and your ability to make use of the debugger.
All you can do is become familiar with how memory is used in a .Net app, where potential problem areas exist, and mitigate them.
One problem area is creating event handlers and then not releasing them, or creating a bitmap or other GDI-like resource without disposing them.
Since we don''t knwo what your mystery app does, we can''t say "go look at this" or "go look at that".
As far as non-leaking memory consumption, try allocating stuff just one time. Repeated allocation/deallocation fragments memory and can stop an application just as completely as memory leaks.