Skip to content

Commit

Permalink
do not collect garbage when previewing
Browse files Browse the repository at this point in the history
Fixes #19
  • Loading branch information
rebinf committed Aug 5, 2023
1 parent e304313 commit 57b97b6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/QuranVideoMaker/Data/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,12 @@ public List<FrameContainer> RenderFrames(int[] frameNumbers, bool preview)
if (progress - lastProgress >= 5)
{
lastProgress = progress;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
if (!preview)
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
ExportProgress?.Invoke(null, progress);
Expand All @@ -847,9 +850,12 @@ public List<FrameContainer> RenderFrames(int[] frameNumbers, bool preview)
sw.Stop();
Debug.WriteLine($"Elapsed: {sw.ElapsedMilliseconds}");

GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
if (!preview)
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}

return frames.ToList();
}
Expand Down

0 comments on commit 57b97b6

Please sign in to comment.