Tracking .NET Out-Of-Memory errors

Add the following registry key:
HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETFramework

Value name: GCFailFastOnOOM
Value type: REG_DWORD
Value data: 4

The value of “4” writes an event message that includes the size of the allocation that failed and the number of bytes in use. A value of “1” simply logs an event in the Application event log. A value of “2” allows a debugger to be attached.

Use the “4” option to grab a dump, then examine the dump for severe fragmentation of the heap, or an attempt to allocate a huge object.

Get contentdbid value

Here’s a shortcut to getting the db_id of the SharePoint content database:

“Go to Central Administration > Application Management > Content Databases. Select the Web Application that is of your interest, and then click on the database name. Once you are on “Manage Content Database Settings” page, you can see the ContentDBID in the URL.”

Or open SQL Management Studio and select a database in Object Explorer. Then click “New Query” and execute the following script: “select DB_ID() as [Database ID];”

This will return the Database ID.