remove the free function entirely. all allocators are now expected to
implement reset instead. I reallized I never ever want to free an
individual allocation ever again. The forever_allocator is a special
case wherEreset is a no-op. The arena allocator was deleted. It will be
replaced soon.
This commit is contained in:
2025-12-02 20:21:12 +01:00
parent ef8d51f153
commit 01b8150625
11 changed files with 62 additions and 385 deletions
+3 -6
View File
@@ -3,14 +3,11 @@
#define EXPECT 5
Test(borrow_allocator, test) {
borrow_allocator_t balloc = borrow_allocator_create();
int *ptr = borrow_allocator_alloc(&balloc, sizeof(int));
allocator_t balloc = borrow_allocator(&borrow_allocator_create());
int *ptr = allocator_alloc(balloc, sizeof(int));
*ptr = EXPECT;
cr_assert_eq(*ptr, EXPECT);
cr_assert_eq(1, borrow_allocator_count_allocations(&balloc));
borrow_allocator_free_all(&balloc);
cr_assert_eq(0, borrow_allocator_count_allocations(&balloc));
borrow_allocator_assert_all_freed(&balloc);
allocator_reset(balloc);
}
#define IS_SIZE 900