DoxigAlpha

destroy

Destroys a previously created item. Only pass items to ptr that were previously created with create() of the same memory pool!

Function parameters

Parameters

#
pool:*Pool

Type definitions in this namespace

Types

#

A memory pool that can allocate objects of a single type very quickly.

Functions

#
MemoryPool
A memory pool that can allocate objects of a single type very quickly.
MemoryPoolAligned
A memory pool that can allocate objects of a single type very quickly.
MemoryPoolExtra
A memory pool that can allocate objects of a single type very quickly.

Error sets in this namespace

Error Sets

#

Source

Implementation

#
pub fn destroy(pool: *Pool, ptr: ItemPtr) void {
    ptr.* = undefined;

    const node = @as(NodePtr, @ptrCast(ptr));
    node.* = Node{
        .next = pool.free_list,
    };
    pool.free_list = node;
}