Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hillshade layers leak GPU memory #7690

Closed
ChrisLoer opened this issue Dec 12, 2018 · 0 comments
Closed

Hillshade layers leak GPU memory #7690

ChrisLoer opened this issue Dec 12, 2018 · 0 comments
Assignees

Comments

@ChrisLoer
Copy link
Contributor

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

@ChrisLoer ChrisLoer self-assigned this Dec 12, 2018
ChrisLoer added a commit that referenced this issue Dec 12, 2018
Fixes #7690 -- hillshade layers leak GPU memory.
ChrisLoer added a commit that referenced this issue Dec 12, 2018
Fixes #7690 -- hillshade layers leak GPU memory.
ChrisLoer added a commit that referenced this issue Dec 12, 2018
Fixes #7690 -- hillshade layers leak GPU memory.
ansis pushed a commit that referenced this issue Dec 12, 2018
ansis added a commit that referenced this issue Dec 12, 2018
pirxpilot pushed a commit to pirxpilot/mapbox-gl-js that referenced this issue Jun 14, 2019
pirxpilot pushed a commit to pirxpilot/mapbox-gl-js that referenced this issue Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant