Skip to content

fix(data): grow small open-addressing tables past their initial capacity - #366

Merged
adamw7 merged 1 commit into
mainfrom
claude/bug-hunt-jwqjs0
Jul 10, 2026
Merged

fix(data): grow small open-addressing tables past their initial capacity#366
adamw7 merged 1 commit into
mainfrom
claude/bug-hunt-jwqjs0

Conversation

@adamw7

@adamw7 adamw7 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

DoubleHashing.grownSize computed the next backing-array length as
(int) (currentLength * 1.2), which truncates to the same value for the
smallest tables: 3 -> 3 and 4 -> 4. A map created with a small initial
size (e.g. new OpenAddressingMap<>(3), floor is 3) that fills up then
resizes to the same length, so put() can never find a free slot and
recurses forever, throwing StackOverflowError. Both OpenAddressingMap
and IntKeyOpenAddressingMap share this growth policy and are affected.

Floor the growth at currentLength + 1 so the table always gets strictly
larger. Add regression tests: grownSize growth for small lengths, and
filling a size-3 map of each type well past its initial capacity.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01CxcEdnagvEwNXcUi3QBxTc

DoubleHashing.grownSize computed the next backing-array length as
(int) (currentLength * 1.2), which truncates to the same value for the
smallest tables: 3 -> 3 and 4 -> 4. A map created with a small initial
size (e.g. new OpenAddressingMap<>(3), floor is 3) that fills up then
resizes to the same length, so put() can never find a free slot and
recurses forever, throwing StackOverflowError. Both OpenAddressingMap
and IntKeyOpenAddressingMap share this growth policy and are affected.

Floor the growth at currentLength + 1 so the table always gets strictly
larger. Add regression tests: grownSize growth for small lengths, and
filling a size-3 map of each type well past its initial capacity.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CxcEdnagvEwNXcUi3QBxTc
@adamw7
adamw7 merged commit 7cc6cdf into main Jul 10, 2026
4 checks passed
@adamw7
adamw7 deleted the claude/bug-hunt-jwqjs0 branch July 10, 2026 09:36
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