- We could coalesce adjacent free blocks
- Create a standalone implementation of malloc() and friends using smart_alloc
- smart_alloc_info - Returns allocation information
- smart_alloc_options - Where to get memory from, whether or not to zero/randomize memory post-free
- What license should this be under?
- Be able to give memory back if we can
- Optionally run tests in a child process
- Or in the middle of read-only memory so we can catch access violations
- free_list.size isn't that accurate; the available size is free_list.size + sizeof(struct free_list) - sizeof(struct alloc)
- Add assertions that can be compiled out
- The free list must never have a cycle
- The last node of the free list must not extend outside of managed memory
- Every free list node must be within managed memory
- Every free list node's size must be greater than 0
- Ideas:
- Allocate more memory callback
- Free memory callback
- Double free callback
- Debug/dump function
- smart_alloc_init2(void *mem, size_t size, size_t sm_size)
- Diagnostics (bytes free, bytes allocated, free list size, # allocations, # frees, # chunks of memory requested via allocation callback)
- Think about mallopt/mallinfo
- Realloc