From 4b9ab2ec5acf2ecf2e96c38733a835b964664171 Mon Sep 17 00:00:00 2001 From: Omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sun, 25 Feb 2024 11:02:46 +1100 Subject: add an arena allocator first impl --- tests/arena_tests.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/arena_tests.c (limited to 'tests/arena_tests.c') diff --git a/tests/arena_tests.c b/tests/arena_tests.c new file mode 100644 index 0000000..88fc21b --- /dev/null +++ b/tests/arena_tests.c @@ -0,0 +1,12 @@ +/* +size_t arena_size = 16; + arena scratch = arena_create(malloc(arena_size), arena_size); + + i32* int_ptr = arena_alloc(&scratch, sizeof(i32)); + i32* b = arena_alloc(&scratch, sizeof(i32)); + i32* c = arena_alloc(&scratch, sizeof(i32)); + *int_ptr = 55; + printf("Int pointer %d %p\n", (*int_ptr), int_ptr); + + // will abort on second arena alloc +*/ \ No newline at end of file -- cgit v1.2.3-70-g09d2