-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
What: The simple free-list allocator in include/webcc/core/allocator.h can cause fragmentation and may not coalesce adjacent free blocks; edge-cases (e.g., malloc(0)) need clarification and tests.
Where: include/webcc/core/allocator.h
Repro: Write tests that allocate and free various sized blocks repeatedly and observe whether freed memory is reused or memory growth increases unnecessarily.
Proposed fix:
- Implement block coalescing in
free()to merge adjacent free blocks. - Add unit tests that exercise alloc/free reuse and fragmentation scenarios.
- Document behavior for
malloc(0)in the header/docs.
Acceptance criteria:
- Unit tests show freed blocks are reused and fragmentation is reduced.
- Memory growth in repeated alloc/free tests is improved.
- Header or docs include a clear statement about
malloc(0)behavior.