Skip to content

fix pthash memory estimate#97

Merged
jermp merged 2 commits into
masterfrom
claude/fix-pthash-memory-estimate-NhgTI
May 6, 2026
Merged

fix pthash memory estimate#97
jermp merged 2 commits into
masterfrom
claude/fix-pthash-memory-estimate-NhgTI

Conversation

@jermp
Copy link
Copy Markdown
Owner

@jermp jermp commented May 6, 2026

No description provided.

claude added 2 commits May 6, 2026 07:55
estimate_num_bytes_for_construction returned max(map_bytes, search_bytes),
but the input hash vector lives across both phases. The partitioned
external builder pushes the per-partition hashes (num_keys *
sizeof(hash_type)) into in_memory_partitions and only adds the build
estimate to its running 'bytes' counter, so the bytes < config.ram gate
underestimated true residency by num_keys * sizeof(hash_type) per
partition.

For hash128 (16B) plus the search-phase peak (~25B/key), peak per-
partition residency is ~41B/key while the gate believed ~25B/key, so
config.ram=2GiB actually allowed ~3.2GB resident. Adding the input
hashes outside the max makes config.ram match observed RSS.
The previous commit added the input hashes outside the max with the
correct sizeof(hash_type), so the pre-existing num_keys * sizeof(uint64_t)
term inside num_bytes_for_search was double-counting.
@jermp jermp merged commit a95e814 into master May 6, 2026
17 checks passed
@jermp jermp deleted the claude/fix-pthash-memory-estimate-NhgTI branch May 6, 2026 09:15
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