mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
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*).
Github-Pull: #28913
Rebased-From: ce881bf9fc
This commit is contained in:
committed by
fanquake
parent
7dda4991a8
commit
bcc183ccce
@@ -163,8 +163,7 @@ BOOST_AUTO_TEST_CASE(memusage_test)
|
||||
std::hash<int>,
|
||||
std::equal_to<int>,
|
||||
PoolAllocator<std::pair<const int, int>,
|
||||
sizeof(std::pair<const int, int>) + sizeof(void*) * 4,
|
||||
alignof(void*)>>;
|
||||
sizeof(std::pair<const int, int>) + sizeof(void*) * 4>>;
|
||||
auto resource = Map::allocator_type::ResourceType(1024);
|
||||
|
||||
PoolResourceTester::CheckAllDataAccountedFor(resource);
|
||||
|
||||
Reference in New Issue
Block a user