Maximum interval for GC.Collect to get valid MonitoringSurvivedMemorySize values on AppDomain

68 views Asked by At

I have a windows service written in c# which uses AppDomain instances for separation purposes. To monitor and manage the AppDomain instances, I use the “Application Domain Resource Monitoring” option.

To get a valid value for the AppDomain.MonitoringSurvivedMemorySize, I have to call GC.Collect. Since this is a heavy operation, I only want to call it as little as necessary.

Is there a constant or another way to determine what the interval is, which is necessary to not letting running the MonitoringSurvivedMemorySize property to be reset and returning zero, instead of the last detected amount of memory?

I surely can try to get the interval by trial and error, but there is no guarantee, that the values I get, are in other environments the same.
Or is there an other way altogether to get this information in a reliable manner?

0

There are 0 answers