From 6fa9a8052427f57d02f1b171575fc3853ba44658 Mon Sep 17 00:00:00 2001 From: Sidharth Suresh Date: Sat, 9 Nov 2024 18:03:26 +0100 Subject: [PATCH] Set default memory limit of `LocalVocab` unlimited. Remove unwanted SizeGetter variables. --- src/engine/LocalVocab.h | 7 ++----- src/util/HashSet.h | 7 +++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/engine/LocalVocab.h b/src/engine/LocalVocab.h index 147a2f20f8..17a9154eb4 100644 --- a/src/engine/LocalVocab.h +++ b/src/engine/LocalVocab.h @@ -49,8 +49,6 @@ class LocalVocab { ad_utility::detail::AllocationMemoryLeftThreadsafe limit_; std::shared_ptr primaryWordSet_; - IriSizeGetter sizeGetter; - // Local vocabularies from child operations that were merged into this // vocabulary s.t. the pointers are kept alive. They have to be `const` // because they are possibly shared concurrently (for example via the cache). @@ -66,9 +64,8 @@ class LocalVocab { // Create a new, empty local vocabulary. LocalVocab(ad_utility::detail::AllocationMemoryLeftThreadsafe memoryLimit = ad_utility::makeAllocationMemoryLeftThreadsafeObject( - ad_utility::MemorySize::megabytes(100))) - : limit_(memoryLimit), - primaryWordSet_(std::make_shared(limit_, sizeGetter)) {} + ad_utility::MemorySize::max())) + : limit_(memoryLimit), primaryWordSet_(std::make_shared(limit_)) {} // Prevent accidental copying of a local vocabulary. LocalVocab(const LocalVocab&) = delete; diff --git a/src/util/HashSet.h b/src/util/HashSet.h index 9ce3c02b52..5baa18e728 100644 --- a/src/util/HashSet.h +++ b/src/util/HashSet.h @@ -52,7 +52,7 @@ class NodeHashSetWithMemoryLimit { HashSet hashSet_; detail::AllocationMemoryLeftThreadsafe memoryLeft_; MemorySize memoryUsed_{MemorySize::bytes(0)}; - SizeGetter sizeGetter_; + SizeGetter sizeGetter_{}; size_t currentNumSlots_{0}; // `slotMemoryCost` represents the per-slot memory cost of a node hash set. @@ -71,9 +71,8 @@ class NodeHashSetWithMemoryLimit { MemorySize::bytes(sizeof(void*) + 1); public: - NodeHashSetWithMemoryLimit(detail::AllocationMemoryLeftThreadsafe memoryLeft, - SizeGetter sizeGetter = {}) - : memoryLeft_{memoryLeft}, sizeGetter_{sizeGetter} { + NodeHashSetWithMemoryLimit(detail::AllocationMemoryLeftThreadsafe memoryLeft) + : memoryLeft_{memoryLeft} { // Once the hash set is initialized, calculate the initial memory // used by the slots of the hash set updateSlotArrayMemoryUsage();