All Visual Studio blogs in one place

AddThis Social Bookmark Button
Memory for managed code is handled by the garbage collector, but if you use any kind of unmanaged code, like native resources of any kind, open files, streams and window handles, your application may leak memory if these are not properly handled.  To handle such resources the classes that own these in your application should implement the IDisposable interface, and preferably implement it according to the pattern described for that interface. When you suspect a memory leak, the immediate impulse would be to start up a memory profiler and start digging into that.   However, before you
follow that impulse, do a Static Code Analysis run with a ruleset tuned to finding possible memory leaks in your code.  If you get any warnings from this, fix them before you go on with the profiling. How to use a ruleset In Visual Studio 2010 (Premium and Ultimate editions) you can define your own rulesets containing a list of Static Code Analysis checks.   I have defined the memory checks as shown in the lists below as ruleset files, which can be downloadedsee bottom of this post.  When you get them, you can easily attach...(Read whole news on source site)



Enter your email address:

Delivered by FeedBurner

Increase your website traffic with


Anti-spam: How many eyes has a typical person?

Follow us on FB

Home : Blog List : Terje Sandstrom : Using the Static Code Analysis feature of Visual Studio (Premium/Ultimate) to find memory leakage problems