Skip to content

Commit dafc4e1

Browse files
committed
Fix size assertion in concurrent set resizing
Since we resize when `prev_size > set->capacity / 2`, it's possible that `prev_size == set->capacity / 2`, so we need to change the assertion in concurrent_set_try_resize_without_locking to be `new_set->size <= new_set->capacity / 2`.
1 parent 05f51cf commit dafc4e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

concurrent_set.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ concurrent_set_try_resize_without_locking(VALUE old_set_obj, VALUE *set_obj_ptr)
139139
if (entry->key == CONCURRENT_SET_EMPTY) {
140140
new_set->size++;
141141

142-
RUBY_ASSERT(new_set->size < new_set->capacity / 2);
142+
RUBY_ASSERT(new_set->size <= new_set->capacity / 2);
143143
RUBY_ASSERT(entry->hash == 0);
144144

145145
entry->key = key;

0 commit comments

Comments
 (0)