Class StackPool

Public

Lightweight Stack Pool.

Handy class for pooling stacks of type T.

Usage:

  • Claim a new stack usingStack<SomeClass> foo = StackPool<SomeClass>.Claim ();

  • Use it and do stuff with it

  • Release it withStackPool<SomeClass>.Release (foo);

You do not need to clear the stack before releasing it. After you have released a stack, you should never use it again.

Warning

This class is not thread safe

Since

Version 3.2

Public Static Methods

Claim ()

Claim a stack.

Public Static
Clear ()

Clears all pooled stacks of this type.

Public Static
GetSize ()

Number of stacks of this type in the pool.

Public Static
Release (stack)

Releases a stack.

Public Static
Warmup (count)

Makes sure the pool contains at least count pooled items.

Public Static

Private/Protected Members

pool

Internal pool.

Private Static Readonly
StackPool ()

Static constructor.

Private Static