Fix missing negation in large_ralloc_no_move usize_min fallback

The second expansion attempt in large_ralloc_no_move omitted the !
before large_ralloc_no_move_expand(), inverting the return value.
On expansion failure, the function falsely reported success, making
callers believe the allocation was expanded in-place when it was not.
On expansion success, the function falsely reported failure, causing
callers to unnecessarily allocate, copy, and free.

Add unit test that verifies the return value matches actual size change.
This commit is contained in:
Slobodan Predolac 2026-03-27 09:57:28 -07:00
parent 87f9938de5
commit a0f2bdf91d
4 changed files with 81 additions and 1 deletions

View file

@ -20,6 +20,9 @@
*/
#define JEMALLOC_ARG_CONCAT(...) __VA_ARGS__
/* Number of elements in a fixed-size array. */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
/* cpp macro definition stringification. */
#define STRINGIFY_HELPER(x) #x
#define STRINGIFY(x) STRINGIFY_HELPER(x)