Visual Studio and .NET Framework Home
Long pattern string results in race condition on x64 system but not x86 system.
6/5/2006 8:25:02 AM
User(s) can reproduce this bug
A long pattern string in a Regex constructor works fine on my x86 Windows XP development machine but results in a race condition that eats RAM very fast until an "out of memory" condition occurs an the process is killed on the x64 Windows Server 2003 machine. In steps below, I will cut and paste the code which resulted in the condition--the input exceeds 2000 characters so I will remove some of the lines that concatenate the pattern string but one can easily add additional lines to achieve the result that I experienced. To resolve it or work around it, I simply split the Regex into 19 Regex objects and that resolved the problem.
Visual Studio 2005
Windows Server 2003
Steps to Reproduce
private static Regex nonwords = new Regex(@"\b("
+ + @"ya|ye|yes|you|your|yours|yourself"
+ @")\b", (RegexOptions.IgnoreCase | RegexOptions.Compiled));
The result was a processor red line and runaway memory usage.
The expected result was a string with the specified words in the pattern removed -- ala.. Regex.Replace(input, "");
to post a comment.
Please enter a comment.
on 9/28/2006 at 4:41 PM
Nice to see it's fixed. When or where will it show up?
to post a workaround.
Please enter a workaround.
© 2013 Microsoft