Fixes renderd running out of memory with PostGIS-backed styles when 
`parameterize_style` is configured (e.g. multilingual maps). This is the 
problem we hit at OSM UK on Ubuntu with Postgres; single-threaded SQLite was 
unaffected.

`render()` built a full copy of the Mapnik map and called `set_datasource()` on 
each affected layer for **every tile**. Each PostGIS datasource registers a new 
connection-pool entry in Mapnik's global `ConnectionManager`, and those were 
never released, so memory grew until the server ran out.

Parameterised maps are now built once and cached per render thread per options 
string, so `set_datasource()` runs once per (thread, style, options) 
combination. The cache is small in practice (e.g. one entry per requested 
language).

This replaces part of #497, split up as requested there. Independent of the 
other PRs in this series; it applies to `master` on its own and merges cleanly 
with each of them in any order.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01YForD7qSL9LT6FhMuAoKPV

You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/mod_tile/pull/502

-- Commit Summary --

  * Cache parameterized Mapnik maps per render thread to fix PostGIS memory leak

-- File Changes --

    M src/gen_tile.cpp (53)

-- Patch Links --

https://github.com/openstreetmap/mod_tile/pull/502.patch
https://github.com/openstreetmap/mod_tile/pull/502.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/mod_tile/pull/502
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/mod_tile/pull/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving

Reply via email to