内存泄漏问题 [英] Problem with memory leak

查看:84
本文介绍了内存泄漏问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在开发一个应用程序,我有一些内存泄漏的问题,所以我尝试用一​​个按钮创建另一个应用程序并单击没有代码的事件,当我制作单击该按钮,应用程序的内存会长大。有谁能解释我为什么?或者如果你有一些问题要解决它?

hello everyone,
i''m developing an application and I have some problem of memory leak so I tried to create another application with just one button and click event without code inside and when I make a click on that button the memory of the application grow up. Does anyone can explain me why ? or if you have some issue to resolve it?

推荐答案

我假设你假设这是一个内存泄漏,因为任务管理器显示内存增长...?< br $>


TaskManager将显示为应用程序保留的内存量,而不是实际使用的内存量。如果系统需要保留但未使用的内存,它将被回收。



换句话说,它没什么可担心的 - 只要确保你是处理任何一次性的东西(使用使用块是最好的方法,如果它适用于你的场景)。
I assume you are assuming this is a memory leak as Task Manager is showing the memory growing...?

TaskManager will show you the amount of memory reserved for your application, not the amount actually used. If reserved but not used memory is required by the system it will be reclaimed.

In other words, it''s nothing to worry about - just make sure you are disposing of anything that is disposable (using ''using blocks'' is the best way if it works in your scenario).


我不认为你有内存泄漏问题。内存使用量的增加并不一定意味着内存泄漏。每次单击该按钮时,可能会有许多内存分配和配置,这些内存分配和配置不是代码的一部分,而是.NET Framework本身的一部分。 .NET Framework具有垃圾收集器功能,可在处理后定期释放内存。 .NET Framework中使用的Windows API中也可能存在内存分配和解除分配。



请参阅垃圾收集 [ ^ ]。



除非你能证明你的电脑在数万,数十万或数百万之后内存不足按钮点击,我将继续相信你只是看到.NET Framework内存处理过程和Windows内存处理过程中固有的内存使用量的自然增长。
I don''t think you have a memory leak issue. An increase in memory usage does not necessarily mean a memory leak. Each time you click on the button, there may be many memory allocations and disposes that occur that are not part of your code but are part of the .NET Framework itself. The .NET Framework has a garbage collector function that periodically frees memory after it has been disposed. There also may be memory allocations and deallocations in the Windows APIs that the .NET Framework uses.

See Garbage Collection[^].

Unless you can show that your PC runs out of memory after tens of thousands, hundreds of thousands or millions of button clicks, I''ll continue to believe that you are just seeing the natural growth in memory usage inherent in the .NET Framework memory handling processes and Windows memory handling processes.


这篇关于内存泄漏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆