2008-09-11

SharePoint 2007 - correct disposal of SPSite og SPWeb objects - SPRequest objecst allocation

There has been writtem several articles on how to correct create and dispose SPWeb and SPSite objects, but what to do if you still get errors like:

"An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it. This object will now be disposed. ... To determine where this object was allocated, create a registry key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\HeapSettings. Then create a new DWORD named SPRequestStackTrace with the value 1 under this key"

Do what the error tell you: "Create the registry key and add the DWORD". Then you will get at stack trace which help you determine which part of your (or som others) code that are not coded correctly, but it will not neccesarily get you the answer - just a clue on where to start checking.

Articles:

No comments: