January 17, 2007

dotNET - CLR Profiling and memory management

The .NET CLR manages the memory allocated by .NET managed applications.
The CLR implements Garbage Collection. This GC can run into problems and may not run as well as it should if you implement your applications in certain ways. GC problems may manifest themselves as a slowdown in the application, this maybe due to the GC spending time trying to manage memory which is fragmented, in very large segments or objects with many references.
The CLR manages the memory by using a pointer to the memory addresses, these pointers must do alot of work particularly if an object has many references, each reference requires a pointer.

You can invoke the GC with the System.GC class. GC.collect().

There are some tools and code classes available to monitor memory. One of these is a class called Perfmon (performance monitor), to use this you add a Perfmon instance in your class, this instance gets incremented each time the GC gets used on that object. You may then query the Perfmon object to find which objects are using what memory.



.NET CLR Profiling (TechRepublic article)

1 comment:

Anonymous said...

Hello
soft for windows software,news driver ,games
http://spdimon.info

G'night