Interface IGorgonAllocator<T>
Defines a memory allocator strategy.
Namespace: Gorgon.Memory
Assembly: Gorgon.Core.dll
Syntax
public interface IGorgonAllocator<T> where T : class
Type Parameters
Name | Description |
---|---|
T | The type of object allocated by this allocator. Must be a reference type. |
Methods
| Edit this page View SourceAllocate(Action<T>)
Function to allocate a new object from the pool.
Declaration
T Allocate(Action<T> initializer = null)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | initializer | [Optional] A function used to initialize the object returned by the allocator. |
Returns
Type | Description |
---|---|
T | The newly allocated object. |
Remarks
If the initializer
parameter is supplied, then this callback method can be used to initialize the new object before returning it from the allocator. If the object returned
is null (because an allocator was not supplied to the constructor), then this parameter will be ignored.