1
我在C#应用程序中实现Geckofx 22.0从到位桶(2008年VS)。它运行良好,但唯一的问题是内存消耗。运行应用程序时使用大量的计算机内存。我的应用程序必须播放一些本地flv以及swf文件。Gecfofx 22.0在C#中使用大量的计算机内存
请建议我一些解决方案,我怎么能减少内存消耗???????????
我在C#应用程序中实现Geckofx 22.0从到位桶(2008年VS)。它运行良好,但唯一的问题是内存消耗。运行应用程序时使用大量的计算机内存。我的应用程序必须播放一些本地flv以及swf文件。Gecfofx 22.0在C#中使用大量的计算机内存
请建议我一些解决方案,我怎么能减少内存消耗???????????
您可以定期调用尝试nsIMemory.HeapMinimize:
如:
if (_memoryService == null)
_memoryService = Xpcom.GetService<nsIMemory>("@mozilla.org/xpcom/memory-service;1");
_memoryService.HeapMinimize(true);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern int SetProcessWorkingSetSize(IntPtr process, int minimumWorkingSetSize, int maximumWorkingSetSize);
public void ClearGarbage()
{
GC.Collect();
GC.WaitForPendingFinalizers();
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
}
这个答案可能基本上被解释正是每次通话是和为什么(你认为)这是可以改善有助于解决问题。 –