Defines that no more than a specified number of instances of any type in the
provided typeSet are allowed to exist when this definition is asserted using
MemAssertion.Assert(MemSnapShot, AssertionsDefinition, AssertionsThread).
Namespace:
SciTech.NetMemProfilerAssembly: MemProfiler2 (in MemProfiler2.dll)
Syntax
| C# |
|---|
public void MaxInstances( TypeSet typeSet, int instanceCount ) |
| Visual Basic |
|---|
Public Sub MaxInstances ( _ typeSet As TypeSet, _ instanceCount As Integer _ ) |
| Visual C++ |
|---|
public: void MaxInstances( TypeSet^ typeSet, int instanceCount ) |
Parameters
- typeSet
- Type: SciTech.NetMemProfiler..::..TypeSet
A TypeSet containing the types of the instances that should be checked.
- instanceCount
- Type: System..::..Int32
Defines the maximum number of instances that are allowed to exist of the specified types.
Remarks
Calling MemAssertion.Assert(MemSnapShot, AssertionsDefinition, AssertionsThread)
using this AssertionsDefinition will allow up to instanceCount instances
of the specified types to exist. If more than instanceCount instances exist, then
calling MemAssertion.Assert(MemSnapShot, AssertionsDefinition, AssertionsThread)
using this AssertionsDefinition will fail.
Note
The AllowXXX (AllowInstances(TypeSet), AllowNewInstances(TypeSet)) and
MaxXXX (MaxInstances(TypeSet, Int32), MaxNewInstances(TypeSet, Int32),
MaxBytes(TypeSet, Int64), MaxNewBytes(TypeSet, Int64)) methods takes
precedence over the NoXXX (NoInstances(TypeSet), NoNewInstances(TypeSet)) methods.
For more information see AssertionsDefinition.