Skip to content

Commit

Permalink
Set default memory limit of LocalVocab unlimited. Remove unwanted S…
Browse files Browse the repository at this point in the history
…izeGetter variables.
  • Loading branch information
s1dharth-s committed Nov 11, 2024
1 parent 983483c commit c918f3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/engine/LocalVocab.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class LocalVocab {
ad_utility::detail::AllocationMemoryLeftThreadsafe limit_;
std::shared_ptr<Set> 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).
Expand All @@ -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<Set>(limit_, sizeGetter)) {}
ad_utility::MemorySize::max()))
: limit_(memoryLimit), primaryWordSet_(std::make_shared<Set>(limit_)) {}

// Prevent accidental copying of a local vocabulary.
LocalVocab(const LocalVocab&) = delete;
Expand Down
7 changes: 3 additions & 4 deletions src/util/HashSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();
Expand Down

0 comments on commit c918f3b

Please sign in to comment.