DkmManagedHeapSampler Class

Definition

DkmManagedHeapSampler represents a sampler for objects in the managed heap.

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

public ref class DkmManagedHeapSampler : Microsoft::VisualStudio::Debugger::DkmDataContainer, IDisposable
[System.Runtime.InteropServices.Guid("14537042-a674-0f63-20ba-a9fab411d46a")]
public class DkmManagedHeapSampler : Microsoft.VisualStudio.Debugger.DkmDataContainer, IDisposable
[<System.Runtime.InteropServices.Guid("14537042-a674-0f63-20ba-a9fab411d46a")>]
type DkmManagedHeapSampler = class
    inherit DkmDataContainer
    interface IDisposable
Public Class DkmManagedHeapSampler
Inherits DkmDataContainer
Implements IDisposable
Inheritance
DkmManagedHeapSampler
Inheritance
DkmManagedHeapSampler
Attributes
Implements

Properties

IsUnloaded

Returns true if a 'unloaded' event has been raised for this object (example: DkmThread::Unload is called) or if the object has been closed. Note that care must be used when checking this status as, without synchronization, the returned status may no longer be accurate the instruction after it is read.

(Inherited from DkmDataContainer)
RuntimeInstance

The DkmRuntimeInstance class represents an execution environment which is loaded into a DkmProcess and which contains code to be debugged.

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

UniqueId

Guid which uniquely identifies this DkmManagedHeapSampler.

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

WorkerConnection

[Optional] Specifies a connection to a worker process where the Heap Sampler's operations will be processed.

This API was introduced in Visual Studio 16 RTM (DkmApiVersion.VS16RTMPreview).

Methods

AnalyzeDuplicateStrings()

Analyze the duplicate strings found on the heap, without returning them. Should be called after the objects walk, and never after the roots walk as the process may have resumed.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 7 (DkmApiVersion.VS17Update7).

AnalyzeEventHandlerLeaks(String[])

Analyze the event handler leaks found on the heap, without returning them. Should be called after the objects walk, and never after the roots walk as the process may have resumed.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 8 (DkmApiVersion.VS17Update8).

AnalyzeSparseArrays()

Analyze the sparse arrays.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 6 (DkmApiVersion.VS17Update6).

Close()

Closes a DkmManagedHeapSampler object instance. This will release any resources associated with this object across all components. This includes resources across computer or managed/native marshalling boundaries.

DkmManagedHeapSampler objects are automatically closed when their associated DkmRuntimeInstance object is closed.

This method may only be called by the component which created the object.

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

Create(DkmRuntimeInstance, DkmDataItem)

Create a new DkmManagedHeapSampler object instance. The caller is responsible for closing the created object after they are done.

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

Create(DkmRuntimeInstance, DkmWorkerProcessConnection, DkmDataItem)

Create a new DkmManagedHeapSampler object instance. The caller is responsible for closing the created object after they are done.

This API was introduced in Visual Studio 16 RTM (DkmApiVersion.VS16RTMPreview).

DeferRootsAnalysis()

Indicate to the heap sampler that roots analysis should be deferred and that results should be returned without live objects identified.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 4 (DkmApiVersion.VS17Update4).

GetAddressesForDuplicatedStringValue(String)

Retrieve all the addresses found for the given duplicated string value. Only returns valid results for strings obtained via GetNextDuplicateStrings.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 5 (DkmApiVersion.VS17Update5).

GetDataItem<T>()

Gets the instance of 'T' which has been added to this container instance. If this container does not contain a 'T', this function will return null.

(Inherited from DkmDataContainer)
GetNextDuplicateStrings(UInt32)

Attempts to retrieve the value of the next requested portion of the duplicate strings from the managed heap. Should not be called before the heap walk has completed.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 5 (DkmApiVersion.VS17Update5).

GetNextEventHandlerLeaks(UInt32)

Attempts to retrieve the value of the next requested portion of the instances of the event handler leaks from the managed heap. Should not be called before the heap walk has completed.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 8 (DkmApiVersion.VS17Update8).

GetNextEventHandlerLeaksJMC(UInt32)

Attempts to retrieve the value of the next requested portion of the instances of the event handler leaks from the managed heap with excluded types filtered out. Should not be called before the heap walk has completed.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 8 (DkmApiVersion.VS17Update8).

GetNextSparseArrayDetails(DkmManagedTypeId, UInt32)

Attempts to retrieve the value of the next requested portion of the sparse array instance objects.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 6 (DkmApiVersion.VS17Update6).

GetNextSparseArraySummaries(UInt32)

Attempts to retrieve the value of the next requested portion of the sparse array summary objects.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 6 (DkmApiVersion.VS17Update6).

GetRoots()

Returns roots from the sampled heap.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

GetSampledHeapData(UInt32)

Returns the next requested portion of serialized object graph data.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

GetSampledHeapDataWithoutRoots(UInt32)

Returns the next requested portion of serialized object graph data, without including root information.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 4 (DkmApiVersion.VS17Update4).

GetSampledHeapTypeStats()

Returns the heap type stats.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

GetSampledHeapTypeStats176(Boolean)

Returns the heap type stats, optionally including dead objects in the counts.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 6 (DkmApiVersion.VS17Update6).

GetSegments()

Gets the list of segments in the heap.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 7 (DkmApiVersion.VS17Update7).

GetTotalBytesWastedByEventHandlerLeaks()

Returns the total amount of bytes leaked by event handlers on the managed heap. This calculation is separate from the BytesWasted value of each leak info struct. This is because the sub trees of leaks can overlap, leading to double counting retained objects.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 8 (DkmApiVersion.VS17Update8).

GetTotalBytesWastedByEventHandlerLeaksJMC()

Returns the total amount of bytes leaked by event handlers on the managed heap with with excluded types filtered out. This calculation is separate from the BytesWasted value of each leak info struct. This is because the sub trees of leaks can overlap, leading to double counting retained objects.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 17 Update 8 (DkmApiVersion.VS17Update8).

InitializeHeapObjectWalk(UInt32, Boolean)

Initializes heap sampler.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

NextObjects(UInt32)

Walks the given number of objects on the heap.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

NextReferences(UInt32)

Walks the given number of references on the heap.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

NextRoots(UInt32)

Walks the given number of GC roots on the heap.

Location constraint: API must be called from an IDE component (component level > 100,000).

This API was introduced in Visual Studio 12 RTM (DkmApiVersion.VS12RTM).

RemoveDataItem<T>()

Remove the instance of 'T' from this container. It is usually unnecessary to call this method as a data container will automatically be emptied when the object is closed.

(Inherited from DkmDataContainer)
SetDataItem<T>(DkmDataCreationDisposition, T)

Place a new item in the data container.

(Inherited from DkmDataContainer)

Explicit Interface Implementations

IDisposable.Dispose()

To be added.

Applies to