Heap Dump File Information

Introduction

Garbage collector heap dump files are text files that include information for every object present in the garbage collector heap at the time the dump is generated. The XNA Framework Remote Performance Monitor creates the heap dumps. For more information about generating heap dumps, see How to: Generate a Garbage Collector Heap Dump.

Heap Dump File Records

Each line in the heap dump text file contains one record. The five types of records in the file are as follows.

  • AppDomain record – identifies the application domain to which the dump file applies.
  • Type record – describes a type that is present in the heap.
  • Object record – describes an instance of a type that is present in the heap.
  • Root record – describes a root instance.
  • End AppDomain record – marks the end of the dump file.

Each record contains several elements separated by spaces. The first element in each line indicates the record type. The following example shows a section of a dump file.

Note

This example is intended to show the format of the file, and may not be semantically accurate.

a 2 bubblecs.exe 763f9d2
t 2 System.RuntimeType
o 7c79f 2 64
t 1 System.NullReferenceException
o 7cb42 2 64
o 1ce004 1 18
t 3 System.OutOfMemoryException
o 1ce056 1d 118 1ce11f 1ce14c 1ce079 1ce113 1ce116 1ce267 1ce26a 1ce26d
r 22c81b 5 0
o 22c81e 1b 24
r 22c81e 5 0
o 22c823 1b 28
r 22c823 5 0
c bubblecs.exe 763fbef

AppDomain Record

An AppDomain record marks the beginning of a file section that pertains to a particular application domain. All the type, object, and root information for the garbage collector heap for that application domain is included in this section of the file. All AppDomain records close with a corresponding End AppDomain record.

The AppDomain record has four elements.

  • Letter "a" – identifies the record as an AppDomain record.
  • Version number – number used to track the file format of the dump file. For example, in the .NET Compact Framework version 2.0 Service Pack 2, this number is always "2".
  • AppDomain name – name of the application domain used to generate the heap dump file. This is typically the name of the executable that ran in the application domain.
  • Time stamp – time that the log data was generated. This value shows the number of milliseconds, represented as a hex value, since the device booted.

The following example shows an AppDomain record.

a 2 HH3.exe 763f9d2

Type Record

Type records identify types in the garbage collector heap. Each Type record contains three elements.

  • Letter "t" – identifies the record as a Type record.

  • Type ID – unique numeric identifier for the type. This identifier ties object instances to their types. (See the description of Object records in the next section.)

    Note

    The type ID is not guaranteed to be unique across dump files. For example, the identifier for the "CorporateContacts" type in the following example is not guaranteed to be "a1" in a different dump that is taken from the same application at a different point in time.

  • Type name – fully qualified name of the type.

The following example shows a Type record.

t a1 com.PBSG.WATS.HH3.Biz.Entity.CorporateContacts

Object Record

Object records describe specific instances of types in the garbage collector heap. Object records have a variable number of elements.

The first four elements are required, and are as follows.

  • Letter "o" – identifies the record as an Object record.

  • Object ID – unique numeric identifier for the object.

    Note

    Object identifiers are not guaranteed to be unique across dump files. Because object identifiers can change in different dumps of the same heap, it is not possible to develop tools that identify trends across dump files.

  • Type ID – identifier for the type of the object.

  • Object size – size, in bytes, of the object instance.

In addition to the four required elements, Object records may have a variable number of the following element.

  • Referenced object IDs – identifies other objects that the object references.

The Type record that corresponds to a particular Object record is not guaranteed to precede the Object record in the dump file.

The following example shows an Object record with three referenced object IDs.

o 1ce056 1d 118 1ce11f 1ce14c 1ce079

Root Record

Root records identify garbage collector roots.

Each Root record contains four required elements.

  • Letter "r" – identifies the record as a root record.

  • Object ID – identifier of the root object.

  • Root descriptor – explains why the object instance is classified as a root.

    The following table shows the possible values for the descriptor.

    Value Definition
    0 The object instance is rooted internally by the .NET Compact Framework. For example, this includes object instances for application domains, assemblies, exceptions, and so forth.
    1 The object instance is a local variable.
    2 The object instance is on the finalizer queue waiting for its finalizer to run. After the finalizer runs, the object will be collected during the next garbage collection.
    3 A garbage collector handle (that is, a GCHandle) exists that refers to the object instance.
    4 The object instance is a static variable.
    5 The object instance is a root that is specific to the garbage collection implementation in the .NET Compact Framework. For example, this includes interned strings and class descriptions.
  • Root flag – flags that provide more information about the root.

    The following table shows the possible flags.

    Flag Definition
    0 Normal root. This value is applied to the root if none of the other flags apply.
    1

    The root is pinned. A root can be pinned for the following reasons.

    • It refers to managed objects that are passed to native code through platform invoke.
    • It is referenced by a GCHandle that is created with a GCHandleType of Pinned.
    • A pointer in unsafe code points to the object.
    • A value type field within the object is referenced directly by a method argument.
    2 A GCHandle whose GCHandleType is Weak refers to the object.
    4 The object is pointed to by a pointer in unsafe code or is referenced by a value type field inside another object.

If the root descriptor is static (4), the root record will have an additional element.

  • Root container – identifier of the type that contains the static variable.

The following example shows a root record with an additional root container element.

r b2753 4 0 13c

End AppDomain Record

End AppDomain records close the section that is initiated by a corresponding AppDomain record.

End AppDomain records have three elements.

  • Letter "c" – identifies the record as an End AppDomain record.
  • Application name – name of the application from which the dump file was generated. This name matches the name in the AppDomain record at the beginning of the file.
  • Time stamp – time that the log data was completed. This value shows the number of milliseconds, represented as a hex value, since the device booted.

The following example shows an End AppDomain record.

c HH3.exe 763fbef

See Also

Tasks

How to: Monitor Performance at Run Time (Xbox 360)
How to: Generate a Garbage Collector Heap Dump

Reference

GCHandle
GCHandleType