summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-02-13 14:49:52 -0500
committerBen Gamari <ben@smart-cactus.org>2023-02-20 15:29:22 -0500
commitcdb39b95fe6d562abc6c1af9a8c0b208dd81681b (patch)
tree990f4e1e8cf3828064c7c4da0281d0b25b10e47b
parent48ecd4b4dca42cf482847d7629c91d2b44eae252 (diff)
downloadhaskell-wip/T22965-9.2.tar.gz
rts: Correctly align Capability allocationswip/T22965-9.2
Previously we failed to tell the C allocator that `Capability`s needed to be aligned, resulting in #22965. (cherry picked from commit 4af27feabf482cf6b611951443e05ee7e53acb39)
-rw-r--r--rts/Capability.c7
1 files 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);