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
Methods
Decrement(Type)
Records one fewer live instance of type. The count does not go below
zero.
public static void Decrement(Type type)
Parameters
typeType
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
typeType
Returns
GetCount<T>()
The number of live instances of T. Zero when the type has never been
tracked.
public static long GetCount<T>()
Returns
Type Parameters
T
Increment(Type)
Records one more live instance of type.
public static void Increment(Type type)
Parameters
typeType
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
typeType
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