Mojira Archive
MC-186052

Client leaks GPU / OS memory when reloading textures

The bug

Minecraft never deletes textures of the skins, causing it to stay loaded forever.

How to reproduce

  1. Log in into any multiplayer server/give yourself bunch of player heads
  2. Log off
  3. Reload resources (optionally, just to provde that it does not solve the problem)
  4. Acquire heap dump: textures remain loaded

Affects all Minecraft versions starting at least from 1.12.x.

Code analysis

When textures are reloaded (official mappings are used), net.minecraft.client.renderer.texture.TextureManager releases all textures it has, but never deletes skins, because their textures are not missing, causing them to load back in.
 

            while (iterator.hasNext()) {
                entry = iterator.next();
                resourceLocation = entry.getKey();
                abstractTexture = entry.getValue();
                if (abstractTexture == MissingTextureAtlasSprite.getTexture() && !resourceLocation.equals(MissingTextureAtlasSprite.getLocation())) {
                    iterator.remove();
                }
                else {
                    abstractTexture.reset(this, resourceManager, resourceLocation, executor2);
                }
            }

Heap screenshot: