-
Notifications
You must be signed in to change notification settings - Fork 378
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
Bug in Table (hash table) implementation (and potential GC bug) #144
Comments
@orangeduck There appears to be a bug in Table.c because for this simplified test case I get unexpected results:
output shows duplicated keys "b" and "d":
however, changing to use assign for the existing keys that were added in first pass works:
output is correct:
This change seems to work but is probably covering up a deeper issue.
|
Yeah looks like there is a bug somewhere... I wrote this code almost 10 years ago so unfortunately I have no real memory of how it works or what might be wrong. All I really remember is that it is using robin hood hashing, which is also used by Dictionary and the Garbage Collector. Given it seems this bug is specific to Table (and does not appear in Dictionary or the GC as far as I know) it is probably somehow related to the fact that Table is meant to be like an owning container - so it might not be moving the contents properly during "rehashing" or "set". |
I was playing with libCello (git commit: dfcd86c)
and I found a strange behaviour in Table implementation.
When the table resizes, some values are modified/lost (check the lines with
// BUG
).Also, it looks like GC is taking forever (O(n^2) or more) as the
PROBLEM SIZE
increases.The code to reproduce the issue is here:
The text was updated successfully, but these errors were encountered: