DoxigAlpha

queryCapacity

Queries the current memory use of this arena. This will not include the storage required for internal keeping.

Function parameters

Parameters

#

This allocator takes an existing allocator, wraps it, and provides an interface where

Types

#
ArenaAllocator
This allocator takes an existing allocator, wraps it, and provides an interface where

Source

Implementation

#
pub fn queryCapacity(self: ArenaAllocator) usize {
    var size: usize = 0;
    var it = self.state.buffer_list.first;
    while (it) |node| : (it = node.next) {
        // Compute the actually allocated size excluding the
        // linked list node.
        const buf_node: *BufNode = @fieldParentPtr("node", node);
        size += buf_node.data - @sizeOf(BufNode);
    }
    return size;
}