Prism Ruby parser
Loading...
Searching...
No Matches
Typedefs | Functions
arena.h File Reference

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.

Function Documentation

◆ pm_arena_new()

PRISM_EXPORTED_FUNCTION PRISM_NODISCARD pm_arena_t * pm_arena_new ( void  )

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.

◆ 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.