Class StackPool


Lightweight Stack Pool.

Handy class for pooling stacks of type T.


  • 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.


This class is not thread safe


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

StackPool ()

Static constructor.

Private Static

Internal pool.

Private Static Readonly