XII Release 0.1.0
Loading...
Searching...
No Matches
xiiFrameAllocator Class Reference

#include <FrameAllocator.h>

Static Public Member Functions

static XII_ALWAYS_INLINE xiiAllocator * GetCurrentAllocator ()
static void Swap ()
static void Reset ()
 Resets both buffers, typically called during shutdown.

Detailed Description

Global frame allocator for temporary allocations that are reset each frame.

This is a convenience wrapper around xiiDoubleBufferedLinearAllocator that provides a global instance for frame-based allocations. Very efficient for temporary data that only needs to live for one frame (UI layouts, temporary strings, intermediate calculations, etc.).

Usage pattern:

  • GetCurrentAllocator() - get allocator for current frame
  • Swap() - called once per frame to switch buffers (usually by the engine)
  • Reset() - resets both buffers (usually called during shutdown)

Performance characteristics:

  • Allocation: O(1) - just advances a pointer
  • Deallocation: Not supported individually, entire frame is reset at once
  • Memory overhead: Minimal, just stack pointers

Member Function Documentation

◆ GetCurrentAllocator()

XII_ALWAYS_INLINE xiiAllocator * xiiFrameAllocator::GetCurrentAllocator ( )
inlinestatic

Returns the allocator for the current frame.

All allocations from this allocator will be automatically freed when the frame ends.

◆ Swap()

void xiiFrameAllocator::Swap ( )
static

Swaps the active buffer, should be called once per frame.

This makes the previous frame's allocations invalid and resets the allocator for new allocations.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Memory/FrameAllocator.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Memory/Implementation/FrameAllocator.cpp