diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 51b0525a..a234f432 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -2517,6 +2517,7 @@ namespace Volian.Controls.Library if (SelectionStack.Count == 0) _SelectionStack = null; Select(selection.SelectionStart, selection.SelectionLength); + selection = null; } public class SelectionData { @@ -2572,6 +2573,7 @@ namespace Volian.Controls.Library } private void FindLinks() { + //int oldRegexCacheSize = Regex.CacheSize; string str = Text; _LinkLocations = new List(); MatchCollection matches = Regex.Matches(str, @"", RegexOptions.Singleline); @@ -2586,6 +2588,9 @@ namespace Volian.Controls.Library match.Value, matchrtf.Index, matchrtf.Length, thisLink); _LinkLocations.Add(thisLink); } + //Regex.CacheSize = 0; + GC.Collect(); // there is a memory leak in Regex this fixes it. + //Regex.CacheSize = oldRegexCacheSize; } private LinkLocation FindBetweenLinks() {