Remove GC.Collect() calls and replace by only one (see comment)

This commit is contained in:
Flamefire committed 2014-03-16 18:44:34 +01:00
1 parent 542c8a5b37
commit 8ea9698e2d
3 files changed
+3 -4

No files matched your search

-2
View File
@@ -374,7 +374,6 @@ namespace Vocaluxe.Base
CLog.StopBenchmark("Load Covers/Notes"); CLog.StopBenchmark("Load Covers/Notes");
} }
CLog.StopBenchmark("Load Songs "); CLog.StopBenchmark("Load Songs ");
GC.Collect();
} }
public static void LoadCover() public static void LoadCover()
@@ -419,7 +418,6 @@ namespace Vocaluxe.Base
song.LoadSmallCover(); song.LoadSmallCover();
NumSongsWithCoverLoaded++; NumSongsWithCoverLoaded++;
} }
GC.Collect();
_CoverLoaded = true; _CoverLoaded = true;
CDataBase.CommitCovers(); CDataBase.CommitCovers();
} }
+3
View File
@@ -230,6 +230,9 @@ namespace Vocaluxe
CLog.StopBenchmark("Init Party Modes"); CLog.StopBenchmark("Init Party Modes");
Application.DoEvents(); Application.DoEvents();
//Only reasonable point to call GC.Collect() because initialization may cause lots of garbage
//Rely on GC doing its job afterwards and call Dispose methods where appropriate
GC.Collect();
} }
catch (Exception e) catch (Exception e)
{ {
-2
View File
@@ -577,7 +577,6 @@ namespace Vocaluxe.Screens
_Texts[_TextSongName].Text = String.Empty; _Texts[_TextSongName].Text = String.Empty;
_Texts[_TextDuetName1].Text = String.Empty; _Texts[_TextDuetName1].Text = String.Empty;
_Texts[_TextDuetName2].Text = String.Empty; _Texts[_TextDuetName2].Text = String.Empty;
GC.Collect();
} }
private void _LoadNextSong() private void _LoadNextSong()
@@ -639,7 +638,6 @@ namespace Vocaluxe.Screens
_SlideShow = GetNewBackground(); _SlideShow = GetNewBackground();
foreach (string bgFile in song.BackgroundFileNames) foreach (string bgFile in song.BackgroundFileNames)
_SlideShow.AddSlideShowTexture(Path.Combine(song.Folder, bgFile)); _SlideShow.AddSlideShowTexture(Path.Combine(song.Folder, bgFile));
_Background = null;
} }
else if (song.BackgroundFileNames.Count == 1) else if (song.BackgroundFileNames.Count == 1)
{ {