J
jeevankodali
Hi
I have an .Net application which processes thousands of Xml nodes each
day and for each node I am using around 30-40 Regex matches to see if
they satisfy some conditions are not. These Regex matches are called
within a loop (like if or for). E.g.
for(int i = 0; i < 10; i++)
{
Regex r = new Regex();
r.Match(..., ...);
}
I assumed that these Regex objects should be deleted by GC. Process
memory keeps on increasing in TaskManager so I decided to check the
performance using .Net Memory profiler. What it showed me is that,
after few iterations, there are 90,000 odd Regex objects in memory. And
there are many GC calls (as shown by the .Net profiler). I am not using
Compiled Regex. Is there any reason why these are not deleted. However,
I overcame this problem using Static variables but just want to get to
the bottom of these so that I might have a better understanding.
Thanks
Jeevan
I have an .Net application which processes thousands of Xml nodes each
day and for each node I am using around 30-40 Regex matches to see if
they satisfy some conditions are not. These Regex matches are called
within a loop (like if or for). E.g.
for(int i = 0; i < 10; i++)
{
Regex r = new Regex();
r.Match(..., ...);
}
I assumed that these Regex objects should be deleted by GC. Process
memory keeps on increasing in TaskManager so I decided to check the
performance using .Net Memory profiler. What it showed me is that,
after few iterations, there are 90,000 odd Regex objects in memory. And
there are many GC calls (as shown by the .Net profiler). I am not using
Compiled Regex. Is there any reason why these are not deleted. However,
I overcame this problem using Static variables but just want to get to
the bottom of these so that I might have a better understanding.
Thanks
Jeevan