As discussed in an earlier article SPRequest allocation callstack logging in WSS 3.0 and MOSS 2007 could be enabled by adding a registry key. The caveat with the registry key was that it required a restart of the process to take effect.
In WSS 4.0 / SP2010 the design has been changed to a more dynamic approach. To enable or disable logging of SPRequest allocation callstack in the new version requires to use the SharePoint object model to change the value of a property of the SharePoint ContentService. Thanks to Powershell this can be easily achieved without a compiler.
Just copy the following code into a file with the extension .ps1 (e.g. EnableSPRequestCallstacks.ps1 for the first script and DisableSPRequestCallstacks.ps1)
$contentSvc = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentSvc.CollectSPRequestAllocationCallStacks = $true
$contentSvc.Update()
To disable SPRequest allcoation callstack logging after you completed testing just replace $true with $false:
$contentSvc = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentSvc.CollectSPRequestAllocationCallStacks = $false
$contentSvc.Update()
To start the powershell scripts please open the SharePoint 2010 Management Shell, switch to the directory where you stored the ps1 files and start them using the following syntax:
PS> .\EnableSPRequestCallstacks.ps1
The changes done by the above listed scripts will be active asap without a need to recycle the process that should be monitored.
Permalink
It does not work, I enabled this in runtime and the errors are still showing me an Allocation ID and not a site or site collection.
Permalink
Hi,
the article does not talk about showing a site or a site collection.
It talks about enabling a callstack which shows the exact location in your code which allocates the memory.
Cheers,
Stefan