Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite loop when emplace() is called with no empty slots #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hugoam
Copy link

@hugoam hugoam commented Oct 17, 2024

Hello

We encountered this, which I believe is a bug, in our usage of ExcaliburHash

Basically, if a HashMap has only Tombstones left, but no Empty slots anymore, emplace() will loop infinitely

My attempt to fix, with a very rough understanding of linear probing and tombstones, is that once we've completed a loop over all elements (reached startItem) we can safely insert in the first encountered tombstone as we are sure there are no duplicate keys

@hugoam hugoam force-pushed the fix-emplace-no-empty-infinite-loop branch from 8e595b5 to fb159c4 Compare October 17, 2024 11:31
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b99119a) to head (fb159c4).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #14   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines         1325      1326    +1     
=========================================
+ Hits          1325      1326    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants