COGLayer never frees the colormap texture of a palette COG
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend, performance
Research direction
Start with packages/deck.gl-geotiff/src/geotiff/render-pipeline.ts to see where palette textures are created, then follow pipeline state and cleanup in packages/deck.gl-geotiff/src/cog-layer.ts, including finalizeState. Add a stub device test using a palette fixture; confirm the texture is destroyed when a source change replaces the pipeline and when the layer is finalized.
Written by the indexing model from the issue text.
Description
[!NOTE]
This issue was written by Claude (Claude Code), not by @kylebarron.
Problem
For a COG with a palette (PhotometricInterpretation = Palette), COGLayer's default pipeline uploads the color map as a GPU texture when it infers the pipeline (render-pipeline.ts#L313-L341).
Nothing destroys that texture. COGLayer destroys only each tile's texture and mask, when the tile unloads (cog-layer.ts#L324-L343). The texture isn't freed when a newer pipeline replaces it, and it isn't freed when the layer is removed.
So every pipeline inference for a palette COG leaks one texture:
- Today: once per load, that is, each time a layer opens a palette COG or its
geotiffchanges. - With #799: once per new
sourceas well.
A color map of 256 entries is a 1 KB texture. A 16-bit palette has 65,536 entries, so its texture is 256 KB (parseColormap). Removing and adding layers adds up over a session, as when MosaicLayer evicts an item and draws it again.
This follows from the code. I haven't measured it in an app.
Proposed fix
- Have
inferRenderPipelinereturn the textures it created, or adestroy(). - COGLayer keeps that with the pipeline in its state.
- COGLayer destroys the texture when a new pipeline replaces it, and in
finalizeState. - Test with a stub device: inferring the pipeline for a palette fixture creates one texture, and both a source change and finalizing destroy it.
Found in the review of #799. Related: #728 (tile textures leaked when a layer is removed).
🤖 Written by Claude Code
- Dominant language
- TypeScript
- Stars
- 232
- Forks
- 34
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 80
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developmentseed/deck.gl-raster
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
developmentseed/deck.gl-raster#798 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
developmentseed/deck.gl-raster#589 ·
Maintainers usually reply within 1 day
-
Add zarr-globe examplePossibly taken @kylebarron claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
developmentseed/deck.gl-raster#568 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
developmentseed/deck.gl-raster#816 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
developmentseed/deck.gl-raster#814 ·
Maintainers usually reply within 1 day
All issues in developmentseed/deck.gl-raster
Similar issues
-
fix(worker): keep normal prepare waiting states failure-freePossibly taken @LichKing-2234 claimed this today. Openagent:codex priority:P1
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AgoraIO-Extensions/agent-infra#3745 ·
Maintainers usually reply within 1 day
-
The five-line work window can drop its oldest line: the per-line byte share ignores the JSON framingPossibly taken @Eapp1e claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
makecindy/cindy#7973 · 1 comment ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 78/100
lingdojo/kana-dojo#33337 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
code-yeongyu/senpi#4917 · 1 comment ·
Maintainers usually reply within 1 day