This fixes a soundness bug in the realloc impl, where we were testing versus layout.size() and not new_size, which will return the wrong results. This probably can cause code to get alignments different than they requested, but maybe nobody noticed, or maybe it's rare enough not to happen much.
Other changes:
Uses the right alignment constant for mimalloc. (The libstd list had gotten stale anyway)
Improved logic for when to use the non-_aligned version of the apis, based on author recommendation (and a little bit of sanity checking added to it in debug mode).
Got rid of some extra checks we were doing on macos, which AFAICT was just copied from libstd's sytem GlobalAlloc.
We don't need it because the libstd one was working around a bug in the macos system allocator, and isn't relevant for us.
Because of the first one, it's probably worth cutting another release after landing this.
Most important change:
This fixes a soundness bug in the realloc impl, where we were testing versus
layout.size()
and notnew_size
, which will return the wrong results. This probably can cause code to get alignments different than they requested, but maybe nobody noticed, or maybe it's rare enough not to happen much.Other changes:
_aligned
version of the apis, based on author recommendation (and a little bit of sanity checking added to it in debug mode).Got rid of some extra checks we were doing on macos, which AFAICT was just copied from libstd's sytem GlobalAlloc.
We don't need it because the libstd one was working around a bug in the macos system allocator, and isn't relevant for us.
Because of the first one, it's probably worth cutting another release after landing this.