C#中的Gecfofx 22.0使用了大量的计算机内存

时间:2013-09-23 13:01:26

标签: c# geckofx

我已经在我的c#app(VS 2008)中从bitbucket实现了Geckofx 22.0。它运行良好,但唯一的问题是内存消耗。运行应用程序时使用大量计算机内存。我的应用程序必须播放一些本地flv以及swf文件。

请告诉我一些如何减少内存消耗的解决方案?

2 个答案:

答案 0 :(得分:2)

您可以尝试定期调用nsIMemory.HeapMinimize:

例如:

if (_memoryService == null)
  _memoryService = Xpcom.GetService<nsIMemory>("@mozilla.org/xpcom/memory-service;1");              
_memoryService.HeapMinimize(true);

答案 1 :(得分:-1)

           [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);
    }