Skip to content

Hillshade layers leak GPU memory #7690

Closed

Description

@ChrisLoer

The hillshade layer reuses webgl textures as a performance optimization, and stores the textures for reuse in a cache in the painter object. The problem is that when we go to reuse existing textures, we look them up based on tile size:

tile.demTexture = tile.demTexture || painter.getTileTexture(tile.tileSize);

But when we store them, we put them in a list based on the dimensions of their underlying texture:

saveTileTexture(texture: Texture) {
const textures = this._tileTextures[texture.size[0]];
if (!textures) {
this._tileTextures[texture.size[0]] = [texture];
} else {
textures.push(texture);
}
}

These are not necessarily the same. For instance on a retina screen, 256px raster dem tiles will have a 514px texture (256x2 + 1px border on either side).

The result is that we cache an unbounded number of textures that we'll never re-use.

Thanks @grorg for reporting this in #4695 (comment)

cc @mollymerp

Activity

  1. self-assigned this
    on Dec 12, 2018
  2. added 2 commits that reference this issue on Dec 12, 2018
    1bcd8dd
    d7d6a66
  3. added a commit that references this issue on Dec 12, 2018
    83a9b53
  4. added 2 commits that reference this issue on Dec 12, 2018
    5a86fbe
    22ab43e
  5. added 2 commits that reference this issue on Jun 14, 2019
    8e502b6
    dce6e76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions