I need to minimize the number of memory allocations in a text-processing inner loop containing a number of calls to Regex.Matches()
. So, the question, given a text length (in characters) t
, a regex pattern length (in characters) of r
and the number of matches m
, what is the approximate number of memory allocations made by Regex.Matches()
, and what is the size of these allocations? Are these influenced by any of the Regex
options?
I've tried going through the source code of Regex
and its associated classes, but am stymied by their complexity. Also did not find much documentation on the web related to the memory usage of Regex.Matches()
. Hence the question.