Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

COGLayer never frees the colormap texture of a palette COG

Open
#800 0 comments 0 reactions 0 assignees View on GitHub

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

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

cog

[!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 geotiff changes.
  • With #799: once per new source as 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 inferRenderPipeline return the textures it created, or a destroy().
  • 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from developmentseed/deck.gl-raster

All issues in developmentseed/deck.gl-raster

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.