Skip to content

Commit 693bb72

Browse files
committed
[MERGE #5507 @VSadov] Always reduce count when removing items from SimpleHashTable
Merge pull request #5507 from VSadov:SimpleHash In particlar `MapAndRemoveIf` used to not reduce `count`. That could cause the table to be larger than necessary in the long term. It was also inflating the count of pinned references as reported in OOM postmotems. Fixes: OS: #18369725
2 parents 75ebad8 + 454b646 commit 693bb72

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Common/DataStructures/SimpleHashTable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ class SimpleHashTable
149149
(*pOut) = current->value;
150150
}
151151

152-
count--;
153152
FreeEntry(current);
154153
#if PROFILE_DICTIONARY
155154
if (stats)
@@ -308,6 +307,7 @@ class SimpleHashTable
308307

309308
void FreeEntry(EntryType* current)
310309
{
310+
count--;
311311
if ( freecount < 10 )
312312
{
313313
current->key = nullptr;

0 commit comments

Comments
 (0)