by Andreas

Sharepoint memory leak – or not?

Potentially excessive number of SPRequest objects (448) currently unreleased on thread 28.  Ensure that this object or its parent (such as an SPWeb or SPSite) is being properly disposed

There is no reason to freak out because your Sharepoint logs are filled with warnings like that one. What it is saying is that your environment has got a fair bit of SPWeb/SPSite objects currently undisposed, but this is not necessarily a memory leak. If you enumerate through a high number of SPWeb objects (like the MySite of every user) the number of objects will exceed the configured threshold, and these messages will appear.

So how do you determine that there is a memory leak? First, search for the following error message:

8l1n An SPRequest object was not disposed before the end of this thread

(or just 8l1n since that’s the unique ID for this message)

THAT’s a bad sign. That message means that at the end of a running thread there was no call to an object’s Dispose() method, and it will float around until eventually getting picked up by the garbage collector. This is a memory leak.

To solve the problem, have a read at this page to see the “best practices” for disposing objects. It is based on Windows SharePoint Services 3, but should still be used as a reference for SP2010.