* Reduce code duplication.
The Apple and Haiku PALs both had *almost* identical code to the POSIX
PAL, differing only in some small argument variables. This is fragile
and easy to accidentally get out of sync. For example, the changes to
`reserve_at_least` involved copying identical code into multiple PALs
and it's easy to accidentally miss one.
This change introduces two optional fields on POSIX-derived PALs:
- `default_mmap_flags` allows a PAL to provide additional `MAP_*`
flags to all `mmap` calls.
- `anonymous_memory_fd` allows the PAL to override the default file
descriptor used for memory mappings.
If a PAL does not provide these, default values are used.
Fixes#219
This change brings in a new approach to managing address space.
It wraps the Pal with a power of two reservation system, that
guarantees all returned blocks are naturally aligned to their size. It
either lets the Pal perform aligned requests, or over allocates and
splits into power of two blocks.
The readme was considerably out of date, with the introduction
being over a year old. This commit reflects the developments and
improvements in stabiity of snmalloc.
The PAL API previously allowed for returning more memory than asked for.
This was when the PAL performed the alignment work, now this is done in
large alloc, so removing from the PAL.
HEADER_GLOBAL was using non-standard attributes to achieve what C++17
now permits with a keyword. Use the standard formulation.
Update the README to note that gcc is still not recommended, but because
of its poor codegen for 128-bit atomic compare and exchange, rather than
because it doesn't support the attribute used for HEADER_GLOBAL.
Make header only library target.
Use the CMake INTERFACE target type to include the build settings for
snmalloc in other projects using headers only.
Made warnings setting a macro for reuse.