aboutsummaryrefslogtreecommitdiff
path: root/src/coins.h
diff options
context:
space:
mode:
authorMartin Leitner-Ankerl <martin.ankerl@gmail.com>2023-11-19 15:57:03 +0100
committerMartin Leitner-Ankerl <martin.ankerl@gmail.com>2023-11-19 18:43:29 +0100
commitce881bf9fcb7c30bb1fafd6ce38844f4f829452a (patch)
tree6d24983b1f30387f655437c40a7624755ea76d2e /src/coins.h
parentd752349029ec7a76f1fd440db2ec2e458d0f3c99 (diff)
pool: make sure PoolAllocator uses the correct alignment
This changes the PoolAllocator to default the alignment to the given type. This makes the code simpler, and most importantly fixes a bug on ARM 32bit that caused OOM: The class CTxOut has a member CAmount which is an int64_t and on ARM 32bit int64_t are 8 byte aligned which is larger than the pointer alignment of 4 bytes. So for CCoinsMap to be able to use the pool, we need to use the alignment of the member instead of just alignof(void*).
Diffstat (limited to 'src/coins.h')
-rw-r--r--src/coins.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/coins.h b/src/coins.h
index a6cbb03133..bbf9e3895f 100644
--- a/src/coins.h
+++ b/src/coins.h
@@ -145,8 +145,7 @@ using CCoinsMap = std::unordered_map<COutPoint,
SaltedOutpointHasher,
std::equal_to<COutPoint>,
PoolAllocator<std::pair<const COutPoint, CCoinsCacheEntry>,
- sizeof(std::pair<const COutPoint, CCoinsCacheEntry>) + sizeof(void*) * 4,
- alignof(void*)>>;
+ sizeof(std::pair<const COutPoint, CCoinsCacheEntry>) + sizeof(void*) * 4>>;
using CCoinsMapMemoryResource = CCoinsMap::allocator_type::ResourceType;