aboutsummaryrefslogtreecommitdiff
path: root/src/test/pool_tests.cpp
AgeCommit message (Collapse)Author
2023-11-20pool: change memusage_test to use int64_t, add allocation checkMartin Leitner-Ankerl
If alignment of the PoolAllocator would be insufficient, then the test would fail. This also catches the issue with ARM 32bit, where int64_t is aligned to 8 bytes but void* is aligned to 4 bytes. The test adds a check to ensure the pool has allocated a minimum number of chunks
2023-11-19pool: make sure PoolAllocator uses the correct alignmentMartin Leitner-Ankerl
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*).
2023-03-23Calculate memory usage correctly for unordered_maps that use PoolAllocatorMartin Leitner-Ankerl
Extracts the resource from a PoolAllocator and uses it for calculation of the node's memory usage.
2023-03-23Add pool based memory resource & allocatorMartin Leitner-Ankerl
A memory resource similar to std::pmr::unsynchronized_pool_resource, but optimized for node-based containers. Co-Authored-By: Pieter Wuille <pieter@wuille.net>