Tech

Guides
 

Monitor .NET application performance with the CLR Profiler

By Tony Patton, Special to ZDNet Asia
Tuesday, April 17, 2007 09:14 AM
When you notice memory issues cropping up in your .NET applications, turn to the freely available CLR Profiler. It allows you to take a peek under the hood of .NET applications and monitor the garbage collector heap.

In the .NET Framework, memory management is supposed to be handled automatically by the system. This allows you to concentrate on the important issues of application design and development. Unfortunately, this utopia has not been completely realized as memory issues still appear in .NET-based applications. This article examines one tool--the CLR (Common Language Runtime) Profile--that you may use to track down memory issues.

Garbage collection
The .NET platform adopted the garbage collection approach used in Java. That is, the .NET system tracks all memory blocks allocated in an application. It knows when memory is allocated and what monitors it uses. The system also knows when it is no longer used and frees it up. The garbage collector handles these tasks, but it does not totally divorce you from understanding memory allocation.

Objects in .NET are allocated from an area of memory called the managed heap. The heap is described as managed because, after you ask it for memory, the garbage collector takes care of its cleanup.

Garbage collection begins by assuming all objects are unnecessary until proven otherwise. An object proves that it is necessary essentially by its references, or who it is referenced by. If the object is necessary, it is not part of the garbage collection cycle. On the other hand, if the object is not necessary, the object is flagged to be discarded.

While garbage collection is an automatic process, you should still be aware of how memory is utilized in an application. This allows you to decide if the application is properly using its memory and how the garbage collector is being utilized. This involves knowing the life of objects used to determine how often garbage collection is called in order for you to determine if the garbage collector is taxed.

Code profilers can help with this process by providing a peek at the inner workings of an application, allowing you to gain a better understanding of memory usage. The .NET CLR includes a profiling API that you may use to write custom profilers for managed applications. There are plenty of commercial profiler tools available, but Microsoft provides a free one called the CLR Profiler.



WORTHWHILE?

0

0 votes
Blog

Talkback 0 comments

There are currently no comments for this post.


Guest user

Guest user

Level: 
Joined: —
Already a member? Log in »



 

Loading...

Whitepapers / Case Studies

Downloads

Web Services News

 
Your complete guide to successful CRM
Discover how Oracle’s proven solutions deliver built-in best practices to increase sales, marketing & service effectiveness.

» Download your free CRM eBooks by Oracle now.



Deliver vital business solutions and services efficiently
Maintain a cost-savvy and change-ready IT infrastructure.
» Blades for simpler IT management
» Deploy server resources in minutes
» Reclaim trapped data center energy


Tech Jobs Now!

Tags

  1. apple inc.
  2. apple iphone
  3. blog
  4. china
  5. google inc.
  6. industry
  7. information technology
  8. internet
  9. microsoft corp.
  10. mobile
  11. network
  12. phone
  13. revenue
  14. security
  15. software
  16. strategy
  17. u.s.
  18. web
  19. web sites
  20. yahoo! inc.