Table of Contents

Class InstanceCounter

Namespace
BSGameLib.Game
Assembly
BSGameLib.Game.dll

Counts live instances of tracked types, so that a leak shows as a count that keeps rising. Code records each instance with Increment(Type) and Decrement(Type).

public static class InstanceCounter
Inheritance
InstanceCounter
Inherited Members

Properties

TotalTracked

The sum of the counts of every tracked type.

public static long TotalTracked { get; }

Property Value

long

Methods

Decrement(Type)

Records one fewer live instance of type. The count does not go below zero.

public static void Decrement(Type type)

Parameters

type Type

Decrement<T>()

Records one fewer live instance of T. The count does not go below zero.

public static void Decrement<T>()

Type Parameters

T

GetCount(Type)

The number of live instances of type. For an interface that is not tracked itself, the total of the tracked types that implement it.

public static long GetCount(Type type)

Parameters

type Type

Returns

long

GetCount<T>()

The number of live instances of T. Zero when the type has never been tracked.

public static long GetCount<T>()

Returns

long

Type Parameters

T

Increment(Type)

Records one more live instance of type.

public static void Increment(Type type)

Parameters

type Type

Increment<T>()

Records one more live instance of T.

public static void Increment<T>()

Type Parameters

T

Reset(Type)

Sets the count of type to zero.

public static void Reset(Type type)

Parameters

type Type

ResetAll()

Forgets every count.

public static void ResetAll()

Reset<T>()

Sets the count of T to zero.

public static void Reset<T>()

Type Parameters

T