This commit is contained in:
Nils O. Selåsdal
2026-05-14 14:45:29 +02:00
parent d04b151279
commit 6185de0694
6 changed files with 15 additions and 16 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
void debug_alloc(const LAlloc *allocator)
{
puts("--debug start--");
for (LBlockHeader *b = allocator->heap_start; b; b = lblock_from_offset(allocator, b->next)) {
for (LBlockHeader *b = (LBlockHeader *)allocator->base; b; b = lblock_from_offset(allocator, b->next)) {
printf("Block size %u free %d prev %u next %u \n", lblock_size(b), lblock_is_free(b), b->prev, b->next);
}
puts("--debug end--");
+2 -3
View File
@@ -12,8 +12,8 @@ struct TestData {
int main(int argc, char *argv[])
{
//_Alignas(16) uint8_t store[2048];
uint8_t *store = malloc(2048);
_Alignas(16) uint8_t store[2048];
// uint8_t *store = malloc(1024 * 1024 - 17);
LPool pool;
lpool_init(&pool, store, 2048, sizeof(struct TestData), _Alignof(struct TestData));
@@ -42,6 +42,5 @@ int main(int argc, char *argv[])
allocs++;
}
printf("Total allocs = %zu, used = %u\n", allocs, pool.used);
return 0;
}