|
cwist
Modern C web framework with libttak runtime
|
Request-scoped arena allocator built on libttak arena generations. More...
#include <cwist/core/mem/arena.h>#include <cwist/sys/platform.h>#include <stdbool.h>#include <stdint.h>#include <stdlib.h>
Go to the source code of this file.
Functions | |
| cwist_arena_t * | cwist_arena_create (size_t generation_bytes) |
| Create an arena backed by a recycled thread-local generation buffer. | |
| void * | cwist_arena_alloc (cwist_arena_t *arena, size_t size) |
Bump-allocate size bytes from the active generation. | |
| bool | cwist_arena_owns (const cwist_arena_t *arena, const void *ptr) |
Check whether ptr lies inside the active generation buffer. | |
| void | cwist_arena_destroy (cwist_arena_t *arena) |
| Retire the generation and destroy the arena, releasing every allocation made from it at once. | |
Request-scoped arena allocator built on libttak arena generations.
Performance notes:
Definition in file arena.c.
| void * cwist_arena_alloc | ( | cwist_arena_t * | arena, |
| size_t | size | ||
| ) |
| cwist_arena_t * cwist_arena_create | ( | size_t | generation_bytes | ) |
Create an arena backed by a recycled thread-local generation buffer.
| generation_bytes | Capacity of the generation buffer (0 = default). |
Definition at line 32 of file arena.c.
References CWIST_ARENA_DEFAULT_GENERATION_BYTES.
Referenced by cwist_http_request_create(), and cwist_http_response_create().
| void cwist_arena_destroy | ( | cwist_arena_t * | arena | ) |
Retire the generation and destroy the arena, releasing every allocation made from it at once.
Definition at line 60 of file arena.c.
Referenced by cwist_http_request_create(), cwist_http_request_destroy(), cwist_http_response_create(), and cwist_http_response_destroy().
| bool cwist_arena_owns | ( | const cwist_arena_t * | arena, |
| const void * | ptr | ||
| ) |
Check whether ptr lies inside the active generation buffer.
Definition at line 54 of file arena.c.
Referenced by cwist_http_request_destroy(), and cwist_http_response_destroy().