I am developing a heap memory allocator based on Hoard for educational purposes. I know how to allocate memory using sbrk and mmap and have developed toy level allocators before.
I want to use mmap for allocating large chunks aside from segregated free lists. I understand how I can malloc, but I do not undestand how can I do a free afterwards. I.e. whether to put a block to free list or to munmap it.
The most basic way to differentiate between block types is to add additional metadata. But, I want to keep metadata minimal.
Is it possible to determine how a block was obtained using only address? Such as range comparison or some kind of system call?