本文介绍了C#.NET测试内存泄漏.快速提问!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试内存泄漏.我要让我的程序长时间发布(向缓存添加字符串)/读取(从缓存中删除字符串)一段时间,以查看内存是否累积或达到一定的学习量.

因此,我正在从System.GC.GetTotalMemory()检查总内存,以查看我正在使用多少内存.

但是我不知道是否应该将其设置为true或false,以允许该方法等待垃圾回收.

我该怎么办?还有其他测试内存泄漏或系统资源泄漏的好方法吗?

I am testing for memory leaks. I am going to let my program post(adds string to cache)/read(delete string from cache) for a long period of time to see if the memory accumulates or becomes study at a certain amount.

So I am checking the totalmemory from the System.GC.GetTotalMemory() to see how much memory I am using.

But I don''t know if I should set it to true or false to allow the method to wait for garbage collection.

Which should I do? Also is there other good ways to test for memory leaks, or system resource leaks?

推荐答案



这篇关于C#.NET测试内存泄漏.快速提问!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:14
查看更多