blob: c3ec61d01d16d13d4c4f85d330d39056ec16992e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/**
* @file mem.h
* @brief Allocators, memory tracking
* @version 0.1
* @date 2024-02-24
*
* @copyright Copyright (c) 2024
*
*/
#pragma once
#include <stddef.h>
// Inspired by https://nullprogram.com/blog/2023/09/27/
typedef struct arena {
char* begin;
char* curr;
char* end;
} arena;
arena arena_create(void* backing_buffer, size_t capacity);
void* arena_alloc(arena* a, size_t size);
void* arena_alloc_align(arena* a, size_t size, size_t align);
void arena_free_all(arena* a);
// TODO: arena_resize
|