Bound individual size of allocation to put in free list
All checks were successful
Tests / Release [gcc] total: 827, passed: 827
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 826, passed: 826
Tests / Coverage total: 825, passed: 825
weaselab/conflict-set/pipeline/head This commit looks good
All checks were successful
Tests / Release [gcc] total: 827, passed: 827
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 826, passed: 826
Tests / Coverage total: 825, passed: 825
weaselab/conflict-set/pipeline/head This commit looks good
This commit is contained in:
@@ -260,7 +260,8 @@ static_assert(sizeof(Node4) < kMinChildrenNode4 * kBytesPerKey);
|
|||||||
|
|
||||||
// Bounds memory usage in free list, but does not account for memory for partial
|
// Bounds memory usage in free list, but does not account for memory for partial
|
||||||
// keys.
|
// keys.
|
||||||
template <class T, int64_t kMemoryBound = (1 << 20)>
|
template <class T, int64_t kMemoryBound = (1 << 20),
|
||||||
|
int64_t kMaxIndividual = (1 << 10)>
|
||||||
struct BoundedFreeListAllocator {
|
struct BoundedFreeListAllocator {
|
||||||
static_assert(sizeof(T) >= sizeof(void *));
|
static_assert(sizeof(T) >= sizeof(void *));
|
||||||
static_assert(std::derived_from<T, Node>);
|
static_assert(std::derived_from<T, Node>);
|
||||||
@@ -296,7 +297,8 @@ struct BoundedFreeListAllocator {
|
|||||||
--liveAllocations;
|
--liveAllocations;
|
||||||
#endif
|
#endif
|
||||||
static_assert(std::is_trivially_destructible_v<T>);
|
static_assert(std::is_trivially_destructible_v<T>);
|
||||||
if (freeListBytes >= kMemoryBound) {
|
if (sizeof(T) + p->partialKeyCapacity > kMaxIndividual ||
|
||||||
|
freeListBytes >= kMemoryBound) {
|
||||||
return free(p);
|
return free(p);
|
||||||
}
|
}
|
||||||
memcpy((void *)p, &freeList, sizeof(freeList));
|
memcpy((void *)p, &freeList, sizeof(freeList));
|
||||||
|
Reference in New Issue
Block a user