Gorgon
Show / Hide Table of Contents

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 Source

Allocate(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.

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author