Added a forced garbage collection to fix an Out Of Memory bug that results from using .Net’s Regex functions (which do not properly reclaim memory)
This commit is contained in:
parent
f4e7d7bfe5
commit
ba3bceadae
@ -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<LinkLocation>();
|
||||
MatchCollection matches = Regex.Matches(str, @"<START](.*?)[[]END>", 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()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user