From 8ea9698e2df988729ae1a427f16bd1eaf4dffeb1 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 16 Mar 2014 18:44:34 +0100 Subject: [PATCH] Remove GC.Collect() calls and replace by only one (see comment) --- Vocaluxe/Base/CSongs.cs | 2 -- Vocaluxe/Program.cs | 3 +++ Vocaluxe/Screens/CScreenSing.cs | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index f66d5b75..8afaaf9f 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -374,7 +374,6 @@ namespace Vocaluxe.Base CLog.StopBenchmark("Load Covers/Notes"); } CLog.StopBenchmark("Load Songs "); - GC.Collect(); } public static void LoadCover() @@ -419,7 +418,6 @@ namespace Vocaluxe.Base song.LoadSmallCover(); NumSongsWithCoverLoaded++; } - GC.Collect(); _CoverLoaded = true; CDataBase.CommitCovers(); } diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index 8926c619..a90b96bd 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -230,6 +230,9 @@ namespace Vocaluxe CLog.StopBenchmark("Init Party Modes"); 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) { diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 9b58c99a..32e0442e 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -577,7 +577,6 @@ namespace Vocaluxe.Screens _Texts[_TextSongName].Text = String.Empty; _Texts[_TextDuetName1].Text = String.Empty; _Texts[_TextDuetName2].Text = String.Empty; - GC.Collect(); } private void _LoadNextSong() @@ -639,7 +638,6 @@ namespace Vocaluxe.Screens _SlideShow = GetNewBackground(); foreach (string bgFile in song.BackgroundFileNames) _SlideShow.AddSlideShowTexture(Path.Combine(song.Folder, bgFile)); - _Background = null; } else if (song.BackgroundFileNames.Count == 1) {