AutosizeImage中可能的内存泄漏 [英] Possible memory leak in AutosizeImage

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

问题描述


我一直在使用以下代码重复显示大约20,000张jpg图像的列表(每5秒显示一次).  几个小时后,我的Windows 8计算机似乎内存不足.  任何人都可以在以下代码中发现一个可能是 造成问题?


I have been using the following code to repeatedly display a list of about 20,000 jpg images (one every 5 seconds).  After a few hours my Windows 8 machine seems to run out of memory.  Can anyone spot a place in the following code that might be causing the problem?

推荐答案

您好RONATMOODYLAKE

Hello RONATMOODYLAKE,

从您的描述中,我对这个问题的第一反应是分配了一些对象,但是它们没有被处置,不确定在这段时间内是否调用了GC,我建议您可以尝试调用GC在适当的时间手动 如显示1000张图片以查看是否有效.

From your description, my first reflection about this issue is that there are objects are allocated however, they are not disposed, not sure during this time, the GC is called, I suggest that you could have a try to call the GC manually at a proper time as after displaying 1000 pictures to see if it works.

这里是描述如何识别和防止.NET应用程序中的内存泄漏的文章,我认为它可以帮助您找到引起的代码行:

Here is an article which describes how to identify and prevent the memory leak in .NET application, I think it could help you to find the caused code line:

识别并防止托管代码中的内存泄漏

此致.


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

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