Sunday, June 21, 2009

Avoiding memory leaks from beggining

Scenario:
Sharepoint is relatively new for lot of developers and its hard to just guide them on something by saying its best practice. I believe in finding ways to provide tools to easily discover common issues so that automatically code can comply with best practice.

You can bing about Best Practice for Disposing objects and there is a utility which can help you to find some of the common problems. You can download it from here -- > Download MSI

Solution:
As I said tools should be easy to use , so here a small tip to make SPDisposeCheck part of you every project.



Steps:
1. Install SPDisposeCheck locally.
2. Open Visual Studio
3. Go to Tools > External Tools > Add a new tool with below settings

Setting:

Title : SPDisposeCheck

Command : C:\Program Files\Microsoft\SharePoint Dispose Check\SPDisposeCheck.exe <-- ( This is default location where SPDisposeCheck is installed )

Arguments : "$(BinDir)$(TargetName)$(TargetExt)" -debug

Use Output Window : Checked
Now just go to Tools > SPDisposeCheck and you can see the report in your output window.

Article:
Best practices

0 comments: