tags:

views:

29

answers:

2

Being able to see the count of SPRequests would be pretty useful for debugging, so - is there a way?

A: 

I would say your best bet for looking at that would be to use a memory profiling tool. Not only should you be able to see the count, but depending on the tool you can see a stack trace of where objects were allocated.

Theres a few out there, for example check out this post

http://stackoverflow.com/questions/399847/net-memory-profiling-tools

Paul Lucas
+1  A: 

Excellent question, it's really annoying to see these warnings in the ULS logs (C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\LOGS)

The SPRequest warning is usually related to undisposed SPWeb or SPSite objects, the best way to avoid this is by doing

using(SPWeb or SPSite instance)
{
    //some code
}

The using statement takes care of disposing the objects properly.

There are some tools available to help you out, e.g. SPDisposeCheck

More info on this on http://msdn.microsoft.com/en-us/library/aa973248.aspx

armannvg
SPDisposeCheck helps, but sadly not always. I was hoping someone could perhaps know about an undocumented method or something like that. Well, one can dream. Thanks anyway.
kerray