Is my program doing GC?

When my program is idle, I suddenly find (in Task Manager) that its CPU usage is like a wave : goes up to 99%, drop to 0%, then up to 99% again, etc. This occurs dozens of times in several seconds. After the CPU usage finally drop down and keep on 0%, the memory usage drops about 30MB(the total memory cost is about 450MB).

Is it doing GC?

[342 byte] By [LeiJiang] at [2007-12-16]
# 1
Hi,

The program does not do the garbage collection. The GC is a infrastructure provided by the CLR. It appears that the Garbage Collection is being performed on your program since the free memory size is increasing.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 2
I am curious, is this an avalon program? At any rate, to see how much time is spent in the GC, run the Performance MMC snap-in (Administrative tools/Performance in start menu), select the .NET CLR Memory performance object, and % time in GC. You can also use the CLRProfiler to see exactly what is collected.

But you will need a smaller test. 450MB will probably be unusable for the CLRProfiler,and for your users as well!Smile.

FrankHileman at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 3
Yes, it's an Avalon program. Since it's occur randomly, I don't know when it will start.

In fact my program does not cost so much memory(450MB), it just because the GC does not do the collection for me. In CLRProfiler, I can see that my program only cost about 200MB memory. The memory will not be collected even if I call GC.Collect(). Maybe there are some memory leakages in my program.

LeiJiang at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 4
I know another person who developed an Avalon application and it has a 300MB working set, making it impossible to debug. And you know the user cannot handle more than one of those types of applicaitions -- their machine will start freezing because of paging operations! So Avalon seems to be a huge memory hog.

It may be internal code in Avalon that causes massive memory use, not your program logic. If it is in the unmanaged heap I think CLRProfiler does not show that? This may be the extra.

There is a histogram in the profiler which will tell you where the memory is going, and you can view it for any period of time. So look in the timeline view for a big triangle -- that is the peak of allocation. The select that area by dragging and look at the histogram view.

200MB is still a big whomper.

FrankHileman at 2007-9-9 > top of Msdn Tech,.NET Development,Common Language Runtime...

.NET Development

Site Classified