Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracking undisposed Disposable objects

Is there a tool that can scan your code and determine which objects that implement IDisposable are not being disposed in a code base at compile time or runtime?

I have possible areas in the code that are not disposing objects but it's hard to look back and see which objects require this in the first place.

like image 484
Jeremy Edwards Avatar asked Mar 08 '09 22:03

Jeremy Edwards


2 Answers

There is a lot of static analysis tooling, which can help here.

Both CodeRush/Refactor Pro and Resharper will, at code time, in Visual Studio, show you undisposed objects.

And FxCop, now packaged as part of Visual Studio Code Analysis can generate compile time warnings for undisposed locals and class members.

like image 194
Scott Weinstein Avatar answered Oct 15 '22 17:10

Scott Weinstein


The ANTS memory profiler from red-gate will help with this at runtime. It's one of my favorite tools.

like image 3
Eric Avatar answered Oct 15 '22 17:10

Eric