In an earlier article I discussed the possibilities to monitor a system for SPSite/SPWeb leaks using the following registry key:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftShared ToolsWeb Server ExtensionsHeapSettings
SPRequestStackTrace = 1
Although this is a very nice registry key helping to isolate such leaks easily it is not recommended to use this registry key on a production system for a longer timeframe.
The reasons is that this registry key imposes the risk for a performance problem caused by a serialization issue in a .NET framework function (System.Diagnostics.StackTrace.ToString()) that generates the text string of the callstack. This .NET framework function uses a Monitor to serialize access to a resource file that holds the strings used in the stack trace like the word “at” which preceeds any line in the callstack.