From cdb39b95fe6d562abc6c1af9a8c0b208dd81681b Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Mon, 13 Feb 2023 14:49:52 -0500 Subject: rts: Correctly align Capability allocations Previously we failed to tell the C allocator that `Capability`s needed to be aligned, resulting in #22965. (cherry picked from commit 4af27feabf482cf6b611951443e05ee7e53acb39) --- rts/Capability.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rts/Capability.c b/rts/Capability.c index edf6a92690..b85a7fd815 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -439,8 +439,9 @@ moreCapabilities (uint32_t from USED_IF_THREADS, uint32_t to USED_IF_THREADS) if (i < from) { new_capabilities[i] = capabilities[i]; } else { - new_capabilities[i] = stgMallocBytes(sizeof(Capability), - "moreCapabilities"); + new_capabilities[i] = stgMallocAlignedBytes(sizeof(Capability), + CAPABILITY_ALIGNMENT, + "moreCapabilities"); initCapability(new_capabilities[i], i); } } @@ -1287,7 +1288,7 @@ freeCapabilities (void) for (i=0; i < getNumCapabilities(); i++) { freeCapability(capabilities[i]); if (capabilities[i] != &MainCapability) - stgFree(capabilities[i]); + stgFreeAligned(capabilities[i]); } #else freeCapability(&MainCapability); -- cgit v1.2.1