Repository navigation
Releases
Releases · kshku/SnMemory
v0.3.6
Fixed
- sn_freelist_allocator_reallocate() split a node at new_size + align without
first checking the node was that big, in both of its in-place paths. The
shrink path tested the space measured from the user pointer, which does not
cover the node header or the alignment padding ahead of it, and the extend
path compared the merged size against new_size and left out the alignment
reserve that sn_freelist_allocator_allocate() adds before it looks for a
node. A node landing in the gap between the two made the subtraction in
split_node_if_possible() underflow instead of going negative, so it split
anyway and left a free node reaching past the end of the block, sized close
to UINT64_MAX. That node covered whatever was allocated above it, so a later
allocation could hand out memory another block was still using. Growing the
three arrays of a sparse set out of one free list hit this and aborted on a
key that came back present twice. Both paths now require the node to cover
new_size + align and fall through to moving the block when it does not, and
split_node_if_possible() refuses a size it cannot cover
v0.3.5
Changed
- Take sncore v0.3.2 rather than v0.3.1
v0.3.4
Changed
- -Wconversion and -Wsign-conversion are on for gcc and clang. The rand_range
helper and the srand call in the tests left the promotion of the rand result
and the run index to implicit conversions
v0.3.3
Fixed
- sn_vm_get_page_size() narrowed the sysconf result with SN_MAX(0, ps), which
turned the documented -1 error return into a page size of zero instead of
reporting it. Every caller then passed a length of zero: mprotect with a length
of zero succeeds and protects nothing, and munmap rejects it with EINVAL, so a
released range could stay mapped. SN_ASSERT is compiled out in release, so it
did not catch this either. The result is now checked before it is narrowed, and
a failed query falls back to the smallest page size these platforms use
v0.3.2
Fixed
- Export sn_freelist_allocator_increase_memory_size from the shared library.
Every other out of line function here carries SN_MEMORY_API, so this one was
the only symbol a shared build would not resolve for a caller
Added
- Test growing a free-list allocator, both with free nodes left and with the
free list exhausted, plus the no-op cases. The test links against the shared
library, so a missing export fails the build rather than only a shared
consumer
Removed
- Two static forward declarations of sn_write_to_bytes and
sn_read_from_bytes, which sncore declares inline and defines in its header
v0.3.1
Fixed
- Fix sn_std_allocator realloc losing the payload when the block moved. It
reallocates a raw block, re-aligns and returns the new address, but only
copied anything when the new address happened to match the old one. Every
block now starts with a header holding its size, and the bytes are moved from
the old offset to the new one - Fix sn_std_allocator realloc writing the new offset over the bytes it was
about to copy. The offset goes in the byte below the payload, so a payload
that shifts upwards lands on top of its own contents. The move happens first
now - Reject a size and alignment whose raw block would not fit, rather than
wrapping around and handing back a block smaller than was asked for
v0.3.0
Added
- Add sn_std_allocator, the standard library backed allocator, moved here
from SnCore where it did not belong - Add std_allocator.h to the snmemory.h umbrella header
- Build the tests against a shared library in CI, which is what catches a
symbol that is missing an export macro
Changed
- Build against SnCore v0.3.1, which fixed the variable length integer
helpers. The freelist stores the distance to its node header in one of them,
so that fix corrects the freelist too
Known issues
- sn_std_allocator realloc does not honour a changed alignment when the block
moves, so an alignment above 16 can return a pointer away from the preserved
contents. Alignments of 16 and below, which is what alignof() yields, are
unaffected.
v0.2.0
Added
- Added sn_*_allocator_get_allocator function which returns SnMemoryAllocator
Removed
- SnAllocator - SnCore defines SnMemoryAllocator
v0.1.0
- First release. See [0.0.0] section in CHANGELOG.md for full changelog.