DVUI

lifo

This allocator requires that the allocations are freed in a LIFO (Last In First Out) order. The purpose is to reuse as much memory as possible throughout a frame.

Can be very useful for quickly printing some text with std.fmt.allocPrint or for temporary arrays.

const msg = std.fmt.allocPrint(dvui.currentWindow().lifo(), "{d}", number);
defer dvui.currentWindow().lifo().free(msg);
// ... Render text in some widget here

For allocations that should live for the entire frame, see Window.arena

Parameters

#
self:*Self
*Self

Source

Implementation

#
pub fn lifo(self: *Self) std.mem.Allocator {
    return self._lifo_arena.allocator();
}