Re: Regex - Memory performance
Willy
One other possibility is that the RegEx objects are reaching Gen2 before
being dereferenced, so they won't be picked up until it does a Gen2 collect.
It won't force a Gen2 collect until it hits the memory high watermark (32mb
free ISTR) as it's cheaper to just keep on allocating memory until something
else needs it.
It's confusing behaviour the first time you see it; process memory in
TaskManager just keeps getting higher and higher for no apparent reason.
Regards
Paul
"Willy Denoyette [MVP]" <willy.denoyett e@telenet.be> wrote in message
news:ug%23ItZzw FHA.2620@TK2MSF TNGP09.phx.gbl. ..[color=blue]
>
> <jeevankodali@g mail.com> wrote in message
> news:1127787056 .983282.157300@ f14g2000cwb.goo glegroups.com.. .[color=green]
>> my two lines of code is similar to the actual situation of the program
>> I am running. And it is similar to what you have written (as an example
>> code). The .Net Memory profiler which I am using shows when GC0, GC1
>> and GC2 kicks off and shows memory going down etc. But the memory used
>> by Regex objects is not going down. Thats what I was trying to say. Its
>> like I am runnign the example code written by you and Regex objects are
>> not being collected.
>>[/color]
>
> Did you actually run the code I showed? Did you check the GC counters when
> it runs?
> If the RegEx objects aren't collected you will see memory usage going up
> without ever going down, resulting in an OM exception, but it's not how
> the program behaves. Again forget about the memory profiler, run the
> program and watch the performance counters.
>
>
> Willy.
>
>[/color]
Willy
One other possibility is that the RegEx objects are reaching Gen2 before
being dereferenced, so they won't be picked up until it does a Gen2 collect.
It won't force a Gen2 collect until it hits the memory high watermark (32mb
free ISTR) as it's cheaper to just keep on allocating memory until something
else needs it.
It's confusing behaviour the first time you see it; process memory in
TaskManager just keeps getting higher and higher for no apparent reason.
Regards
Paul
"Willy Denoyette [MVP]" <willy.denoyett e@telenet.be> wrote in message
news:ug%23ItZzw FHA.2620@TK2MSF TNGP09.phx.gbl. ..[color=blue]
>
> <jeevankodali@g mail.com> wrote in message
> news:1127787056 .983282.157300@ f14g2000cwb.goo glegroups.com.. .[color=green]
>> my two lines of code is similar to the actual situation of the program
>> I am running. And it is similar to what you have written (as an example
>> code). The .Net Memory profiler which I am using shows when GC0, GC1
>> and GC2 kicks off and shows memory going down etc. But the memory used
>> by Regex objects is not going down. Thats what I was trying to say. Its
>> like I am runnign the example code written by you and Regex objects are
>> not being collected.
>>[/color]
>
> Did you actually run the code I showed? Did you check the GC counters when
> it runs?
> If the RegEx objects aren't collected you will see memory usage going up
> without ever going down, resulting in an OM exception, but it's not how
> the program behaves. Again forget about the memory profiler, run the
> program and watch the performance counters.
>
>
> Willy.
>
>[/color]
Comment