Qt raster tile cache has no size cap or eviction #87

Open
opened 2026-10-13 02:27:37 +00:00 by ImBenji · 0 comments
Owner

From the engineering review on 2026-10-13. Timings are flutter test debug mode on macOS and measure CPU work only, so read the scaling and not the milliseconds. Nothing here measured GPU cost.

_qtTileImages (lib/rendering/canvas_painter.dart:415) is only cleared on a scene key change or clearV2TileCache. The band picture cache has a cap; this one does not, so browsing a big map without editing grows texture memory steadily.

Evidence: test/review_probes/perf_static_paint.dart (local, untracked), zoom and pan sweep over a 5000 segment map with no edits:

Scale Images cached Nominal size at 1024x1024 RGBA
0.15 13 52 MB
0.6 115 460 MB
1.2 255 1020 MB
2.4 399 1596 MB

The size is tile count x 4 MB, not measured memory. The theoretical bound is the full pyramid to kQtMaxLevel = 6, 5461 tiles.

Fix sketch: LRU cap by bytes, always keeping levels 0 and 1.

From the engineering review on 2026-10-13. Timings are `flutter test` debug mode on macOS and measure CPU work only, so read the scaling and not the milliseconds. Nothing here measured GPU cost. `_qtTileImages` (`lib/rendering/canvas_painter.dart:415`) is only cleared on a scene key change or `clearV2TileCache`. The band picture cache has a cap; this one does not, so browsing a big map without editing grows texture memory steadily. **Evidence:** `test/review_probes/perf_static_paint.dart` (local, untracked), zoom and pan sweep over a 5000 segment map with no edits: | Scale | Images cached | Nominal size at 1024x1024 RGBA | |---|---|---| | 0.15 | 13 | 52 MB | | 0.6 | 115 | 460 MB | | 1.2 | 255 | 1020 MB | | 2.4 | 399 | 1596 MB | The size is tile count x 4 MB, not measured memory. The theoretical bound is the full pyramid to `kQtMaxLevel = 6`, 5461 tiles. **Fix sketch:** LRU cap by bytes, always keeping levels 0 and 1.
ImBenji added the bugarea:performance labels 2026-10-13 02:27:37 +00:00
ImBenji added this to the Arcs & Angles project 2026-10-13 02:27:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: IMBENJI.NET/Metro-Map-Maker#87