From 909ecf5e6efed35bdaacded96b9337dfee6326ef Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 29 Jul 2026 07:41:15 +0000 Subject: [PATCH 04/13] folly/io/IOBuf: keep HeapPrefix at 8 bytes on ABIs with 4-byte bool On Darwin ppc32 sizeof(bool) is 4, which padded HeapPrefix to 12 bytes and tripped the static_assert(sizeof(HeapPrefix) == 8) meant to keep HeapStorage within jemalloc's 64-byte class. Use uint8_t for the hasMemoryResource flag so the layout is 8 bytes everywhere. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_013G8CDpEyDCCgV4jaMM9WME --- folly/io/IOBuf.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/folly/io/IOBuf.cpp b/folly/io/IOBuf.cpp index 7fdfede6c..7b3345f2a 100644 --- a/folly/io/IOBuf.cpp +++ b/folly/io/IOBuf.cpp @@ -118,7 +118,9 @@ struct IOBuf::HeapPrefix { uint16_t magic = kHeapMagic; std::atomic refcount; // 1 for IOBuf and 1 for SharedInfo (+ data). - bool hasMemoryResource; + // uint8_t rather than bool: ABIs with 4-byte bool (e.g. Darwin ppc32) would + // otherwise grow HeapPrefix past 8 bytes. + uint8_t hasMemoryResource; uint32_t size; }; -- 2.43.0