如何计算c#中缓存键存储时消耗的内存空间
问问题
504 次
2 回答
1
您可以使用作为 Visual Studio 插件的内存分析器。
于 2014-02-17T11:47:58.780 回答
0
您可以通过查询垃圾收集器和缓存对象来找到有关应用程序内存的一般信息。我不确定如何找到缓存使用的确切内存,但这是了解应用程序内存消耗的一个步骤。
// returns the memory consumption of this process
// This includes active objects, objects to be disposed, and items within cache.
// Setting the parameter to 'true' will force a garbage collection before returning the results
GC.GetTotalMemory(false);
// This shows the maximum size available to the cache
// These limits can be set within the app.config / web.config files
Cache.EffectivePrivateBytesLimit;
于 2014-02-17T11:58:22.933 回答