import tables
var t = initTable[int,int](4)
for i in 1..4:
t[i] = i
t.del(i)
t[5] = 5
Running this code gets stuck at line t[5]=5. As far as I can tell, the reason is that deleting an element with del marks the hash bucket with seDeleted, but such buckets will never be reused for new elements. Thus, inserting and deleting four elements will fill up all buckets and inserting the fifth element will fail to find a free one, causing an infinite loop in rawGetImpl.
Consider the following code:
Running this code gets stuck at line
t[5]=5
. As far as I can tell, the reason is that deleting an element withdel
marks the hash bucket withseDeleted
, but such buckets will never be reused for new elements. Thus, inserting and deleting four elements will fill up all buckets and inserting the fifth element will fail to find a free one, causing an infinite loop inrawGetImpl
.