How to collect memory dumps using Managed GC Aware Dump

  • Description

  • Introduction

    Process memory dumps are very efficient sources of information that are used for troubleshooting websites, which is the reason they are frequently requested by Sitecore Support.

    Various tools exist that allow collecting the memory dumps of a specific process, both based on user request (on-demand), as well as based on a specific event (conditional).

    This article describes the way to gather memory dumps using the Managed GC Aware Dump application.

    For other methods of gathering memory dumps, refer to the following article:

  • GATHERING MEMORY DUMP FILES - ON-DEMAND

    To collect a memory dump of the process at a custom point of time, run the Managed GC Aware Dump tool in the following manner:

    ManagedGcAwareDump_x64.exe [Name or PID]

    Note:
    You should select the appropriate version of the tool (ManagedGcAwareDump_x64.exe or ManagedGcAwareDump_x86.exe) depending on the bitness of the target process.

    Note:
    The tool requires a process name or process ID to be passed instead of the "[Name or PID]" argument to identify the target process.

    Use the process name (such as w3wp.exe for IIS 6 or later) when there is only one process with this name.

    Specify the process ID when there is more than one process with the w3wp.exe name. For information on how to get the Process ID of a particular Sitecore instance, refer to this article: How to identify process ID of appropriate Sitecore instance.

  • GATHERING MEMORY DUMP FILES - ON-DEMAND with GC

    Sometimes it is useful to trigger the full garbage collection before gathering the memory dump file. This simplifies the process's memory heap analysis because only live (rooted) objects are present. That is especially useful during high memory usage investigations.

    1. Trigger full GC and collect memory dump file.

    [Automatic mode]

    You can use the Managed GC Aware Dump tool to automatically trigger GC and collect a memory dump file right after GC is completed. To do that, run the tool with the "/fgc" parameter.

    ManagedGcAwareDump_x64.exe /fgc [Name or PID]
    ManagedGcAwareDump_x86.exe /fgc [Name or PID]

    Note:
    This feature has specific requirements. It could be used only if the following conditions meet:


    [Manual mode]

    If your application uses an earlier version of .NET or Visual C++ Redistributable package is not installed, you should perform this operation manually. Perform the following steps:

    1. Download and unzip the GCTrigger.zip archive.
    2. Copy the "GCTrigger.aspx" file to the "/Website" folder.
    3. Configure the ProcDump tool to gather the dump file on a specific exception. Use the "Collect a memory dump file based on a specific first chance exception scenario"(https://kb.sitecore.net/articles/253710#specificfirstchance) and specify the OnGCEndException exception type.
    4. Open the page from point 2 in the web browser (http://hostName/GCTrigger.aspx), press the Force GC button.

    After GC is finished, the ProcDump tool should collect the memory dump file.

    2. Trigger full GC, wait for pending finalizers, and collect memory dump file.

    Use the same steps as for the scenario 1, however apply the following adjustments.

    [Automatic mode] 

    Run the tool with the "/fgc /wpf" parameters:

    ManagedGcAwareDump_x64.exe /fgc /wpf [Name or PID]
    ManagedGcAwareDump_x86.exe /fgc /wpf [Name or PID]

    [Manual mode]

    Press the Force GC and wait for pending finalizers button on the page.

  • GATHERING MEMORY DUMP FILES - ON GEN COLLECTION

    In particular scenarios it might be useful to collect one or several memory dump files prior the GC of a specific heap generation. This may be useful during investigation of frequent GCs or high GC pressure.

    Note: It is possible to use this feature only if your application uses .NET 4.0 or later.

    1. Gather a single memory dump file before GC of a specific heap generation.

    To gather a memory dump file before specific generation collection, run the tool with the "/g[Gen]" parameter, where [Gen] - generation number (0,1,2).

    ManagedGcAwareDump_x64.exe /g[Gen] [Name or PID]
    ManagedGcAwareDump_x86.exe /g[Gen] [Name or PID]

    2. Gather multiple memory dump files before GC of a specific heap generation.

    To gather multiple memory dump files before the the specific generation collection (one memory dump per GC), run the tool with the "/g[Gen]:[N], where [Gen] - generation number (0,1,2), N - number of memory dumps to collect.

    ManagedGcAwareDump_x64.exe /g[Gen]:[N] [Name or PID]
    ManagedGcAwareDump_x86.exe /g[Gen]:[N] [Name or PID]

    Example. Collect 3 memory dump files before the generation 2 collections:

    ManagedGcAwareDump_x64.exe /g2:3 [Name or PID]

Applies to:

CMS 6+

November 21, 2014
November 21, 2014

Keywords: 

  • Performance