Skip to content

fix(deck.gl-geotiff): free a palette COG's colormap texture - #834

Merged
kylebarron merged 1 commit into
mainfrom
kyle/cog-colormap-texture
Nov 2, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/cog-colormap-texture

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

For a palette COG, COGLayer's default pipeline uploads the color map as a texture that every tile shares. Nothing destroyed it: not when a new source replaced the pipeline, and not when the layer was removed. So each palette COG a layer drew leaked one texture: 1 KB for 256 colors, 256 KB for a 16-bit palette. It adds up when MosaicLayer evicts palette items over a session.

  • inferRenderPipeline, which is internal, now also returns destroy. It frees the textures the pipeline shares across tiles, which today is only a palette's colormap.
  • COGLayer keeps it in state as destroyDefaultPipeline. It calls it when a new source replaces the pipeline, and in a new finalizeState when the layer is removed.

Per-tile textures are unchanged: onTileUnload still destroys each tile's texture and mask.

Tests

Two COGLayer tests on the NLCD fixture, a palette COG, with a device that records the textures it creates:

  • A new source destroys the old colormap texture, and not the new one.
  • finalizeState destroys the colormap texture.

Both failed before the fix, with no texture destroyed. The workspace's tests and typecheck pass.

Closes #800

🤖 Written by Claude Code

COGLayer's default pipeline for a palette COG creates a colormap
texture that nothing destroyed: not when a new source replaced the
pipeline, and not when the layer was removed. The pipeline now has a
`destroy`, which COGLayer calls in both cases.

Closes #800

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the fix label Nov 2, 2026

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

@kylebarron
kylebarron merged commit f5762ad into main Nov 2, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/cog-colormap-texture branch November 2, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COGLayer never frees the colormap texture of a palette COG

1 participant