Problem 11
Fixed-Block Pool Allocator
Implement a fixed-block memory pool in C: pool_init(buf, buf_size, block_size), pool_alloc(), and pool_free(ptr).
Requirements
- 01pool_init carves a caller-owned, 8-byte-aligned buffer into floor(buf_size / block_size) fixed-size blocks; block_size is a nonzero multiple of 8.
- 02pool_alloc returns one distinct 8-byte-aligned block from the buffer and never allocates from the heap.
- 03pool_alloc returns NULL after all blocks are allocated.
- 04pool_free returns a previously allocated block so a later allocation can reuse it.
Constraints
- • Submit one compact engineering spec, not implementation code.
- • The generated artifact must use the declared C compiler adapter.
- • Scoring rewards observable behavior and prompt efficiency, not runtime.
Difficulty
expert
Target
12 min
Acceptance
—
Artifact
library