Repository navigation
Conversation
All ~14M planet tile batches were posted to the thread pool up front, each handler copying options and sortOrders (~15 GB at the start of the tile phase). Workers now take the next batch from a shared counter; the batch partition, and so the output, is unchanged. The mbtiles pending-statement buffer had no limit and reached 3.2 GB on the planet. It is now capped at 256 MB; past that, a worker waits for the SQLite lock and drains the buffer itself. Planet anon RSS peak 25.4 GB -> 12.4 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, 32 threads): anonymous memory peak 25.4 → 12.4 GB (−51%), malloc held 27.2 → 14.0 GB (−49%), write buffer peak 3.2 → 0.24 GB. Wall time unchanged within noise (2,449 → 2,482 s).
On a planet build, two things in the tile-writing phase hold far more memory than needed. glibc never returns that memory to the OS, so each early peak stays in RSS until the run ends.
All tile batches were posted to the thread pool up front. A planet has ~14M batches, and each queued handler captured
optionsandsortOrdersby value. That is ~15 GB in use as soon as the tile phase starts. Now each of thethreadNumworkers takes the next batch from a mutex-guarded counter. The batches themselves (and so the output) are unchanged.The mbtiles write buffer had no limit. While SQLite is busy, finished tiles are copied into
pendingStatements. When tile generation outpaces the single SQLite writer, this grows to millions of tiles (3.2 GB in one burst on the planet with #961). The buffer is now capped at 256 MB. Past the cap, a worker waits for the SQLite lock, writes its tile and drains the buffer.Planet, 32 threads,
--store, openmaptiles configMeasured with
mallinfo2()sampled every 10 s and/proc/PID/status. Baseline = #949 + #961.The wall-time difference is within run-to-run noise on a shared server. Without #961 (slower tile workers) the buffer peaked at 0.7 GB, but the up-front batches cost the same ~15 GB.
Germany output is unchanged (same tiles and features; only
poi, which already differs between identical runs).🤖 Generated with Claude Code