diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 58b2b7d..ac83c01 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -260,7 +260,8 @@ static_assert(sizeof(Node4) < kMinChildrenNode4 * kBytesPerKey); // Bounds memory usage in free list, but does not account for memory for partial // keys. -template +template struct BoundedFreeListAllocator { static_assert(sizeof(T) >= sizeof(void *)); static_assert(std::derived_from); @@ -296,7 +297,8 @@ struct BoundedFreeListAllocator { --liveAllocations; #endif static_assert(std::is_trivially_destructible_v); - if (freeListBytes >= kMemoryBound) { + if (sizeof(T) + p->partialKeyCapacity > kMaxIndividual || + freeListBytes >= kMemoryBound) { return free(p); } memcpy((void *)p, &freeList, sizeof(freeList));