Repository navigation
Conversation
Generated points were kept in a std::vector<Point> per thread on the malloc heap (121.8M points on a planet), with doubling slack and copies on every reallocation. Store them in an AppendVector instead: 8192-point chunks from mmap_allocator, which spill to the store files with --store. AppendVector gets a const operator[] for retrievePoint. Planet --store anon RSS peak 13.1 GB -> 11.2 GB, wall time unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gain (planet,
--store): anonymous memory peak 13.10 → 11.24 GB (−14.2%), moved into reclaimable page cache. Wall time unchanged within noise; no change for in-memory runs.Generated points (
LayerAsCentroid,Layeron nodes) are kept in onestd::vector<Point>per thread. On a planet that is 121.8M points × 16 bytes, all in the malloc heap: the vectors grow by doubling, so up to half of each one is unused capacity, and every reallocation briefly holds both the old and the new buffer. With--storethey are also the only generated geometry store that never reaches the store files.This PR stores them in an
AppendVector<Point>instead, the container already used for the output-object index. It grows in 8192-element chunks frommmap_allocator, so there is no doubling slack or copying, and with--storethe points go to the store files like the other geometry.AppendVectorgets a constoperator[](covered in its unit test) so thatretrievePointcan read from it. The bounds check inretrievePointnow uses>=. Before,.at()was what caught an offset equal to the size.Planet, 32 threads,
--store, openmaptiles configBaseline = #961 + #966 (with the scaleRing fix from #941).
/proc/PID/statussampled every 10 s.The 1.9 GB moves from anonymous memory into the page cache of the store files, which the kernel can drop under memory pressure. The wall-time difference is within run-to-run noise.
Without
--store,mmap_allocatoruses anonymous memory, so in-memory runs see no change (Germany: RSS 8.51 vs 8.52 GB, wall 43.7 vs 43.5 s). Germany output is unchanged: same tiles and features; onlypoidiffers, which already differs between identical runs.The patch applies to master on its own and does not depend on #961 or #966.
🤖 Generated with Claude Code