2013-09-23 22 views
1

我在C#應用程序中實現Geckofx 22.0從到位桶(2008年VS)。它運行良好,但唯一的問題是內存消耗。運行應用程序時使用大量的計算機內存。我的應用程序必須播放一些本地flv以及swf文件。Gecfofx 22.0在C#中使用大量的計算機內存

請建議我一些解決方案,我怎麼能減少內存消耗???????????

回答

1

您可以定期調用嘗試nsIMemory.HeapMinimize:

如:

if (_memoryService == null) 
    _memoryService = Xpcom.GetService<nsIMemory>("@mozilla.org/xpcom/memory-service;1");    
_memoryService.HeapMinimize(true); 
-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); 
    } 
+0

這個答案可能基本上被解釋正是每次通話是和爲什麼(你認爲)這是可以改善有助於解決問題。 –

相關問題