From da8e09dacd838e8032725c1feda00dde3a6fd606 Mon Sep 17 00:00:00 2001 From: Wolf Garbe Date: Wed, 13 Dec 2017 10:41:53 +0100 Subject: [PATCH] Memory consumption measurements changed. Memory consumption measurements in Demo now consistent with those in benchmark. --- SymSpell.Demo/SymSpell.Demo.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SymSpell.Demo/SymSpell.Demo.cs b/SymSpell.Demo/SymSpell.Demo.cs index 6d9441a..c78dbf7 100644 --- a/SymSpell.Demo/SymSpell.Demo.cs +++ b/SymSpell.Demo/SymSpell.Demo.cs @@ -17,6 +17,7 @@ class Program public static void Main(string[] args) { Console.Write("Creating dictionary ..."); + long memSize = GC.GetTotalMemory(true); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); @@ -44,10 +45,11 @@ public static void Main(string[] args) //if (!symSpell.CreateDictionary(path)) Console.Error.WriteLine("File not found: " + Path.GetFullPath(path)); stopWatch.Stop(); + long memDelta = GC.GetTotalMemory(true) - memSize; Console.WriteLine("\rDictionary: " + symSpell.WordCount.ToString("N0") + " words, " + symSpell.EntryCount.ToString("N0") + " entries, edit distance=" + symSpell.MaxDictionaryEditDistance.ToString() + " in " + stopWatch.Elapsed.TotalMilliseconds.ToString("0.0") + "ms " - + (Process.GetCurrentProcess().PrivateMemorySize64 / 1000000).ToString("N0") + " MB"); + + (memDelta / 1024 / 1024.0).ToString("N0") + " MB"); //warm up var result = symSpell.Lookup("warmup", SymSpell.Verbosity.All, 1);