Ruby 4.1.0dev (2026-03-22 revision 251fd7a11e442c34c1b60908409e5611f69ef858)
Typedefs | Functions
arena.h File Reference

(251fd7a11e442c34c1b60908409e5611f69ef858)

A bump allocator for the prism parser. More...

#include "prism/compiler/exported.h"
#include "prism/compiler/nodiscard.h"
#include "prism/compiler/nonnull.h"
#include <stddef.h>
Include dependency graph for arena.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct pm_arena_t pm_arena_t
 An opaque pointer to an arena that is used for allocations.
 

Functions

PRISM_EXPORTED_FUNCTION PRISM_NODISCARD pm_arena_tpm_arena_new (void)
 Returns a newly allocated and initialized arena.
 
PRISM_EXPORTED_FUNCTION void pm_arena_free (pm_arena_t *arena) PRISM_NONNULL(1)
 Frees both the held memory and the arena itself.
 

Detailed Description

A bump allocator for the prism parser.

Definition in file arena.h.

Typedef Documentation

◆ pm_arena_t

typedef struct pm_arena_t pm_arena_t

An opaque pointer to an arena that is used for allocations.

Definition at line 18 of file arena.h.

Function Documentation

◆ pm_arena_free()

PRISM_EXPORTED_FUNCTION void pm_arena_free ( pm_arena_t arena)

Frees both the held memory and the arena itself.

Parameters
arenaThe arena to free.

Definition at line 114 of file arena.c.

◆ pm_arena_new()

Returns a newly allocated and initialized arena.

If the arena cannot be allocated, this function aborts the process.

Returns
A pointer to the newly allocated arena. It is the responsibility of the caller to free the arena using pm_arena_free when it is no longer needed.

Definition at line 88 of file arena.c.