Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-133139

The image write callback is never freed, leaking small amounts of memory for each screenshot

XMLWordPrintable

    • Unconfirmed

      Due to MC-133136 it isn't possible to directly check this in current releases, but the same code is present still.

      The STBIWriteCallback instance that is created to save screenshots is never free'd after use, causing a very small memory leak. (This callback exists to fix MC-121714). Simply adding a free call or putting it into the existing try-with-resources block would solve this.

      In 1.13-pre3, the leak detector (-Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.util.DebugAllocator=true) reports:

      [LWJGL] 16 bytes leaked, thread 1 (Client thread), address: 0x2110000
      	at org.lwjgl.stb.STBIWriteCallback.<init>(STBIWriteCallback.java:37)
      	at dfw$a.<init>(SourceFile:325)
      	at dfw$a.<init>(SourceFile:321)
      	at dfw.a(SourceFile:349)
      	at dfw.a(SourceFile:318)
      	at cjh.a(SourceFile:45)
      	at cjh.a(SourceFile:30)
      	at ciz.a(SourceFile:276)
      	at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23)
      	at org.lwjgl.system.JNI.invokeV(Native Method)
      	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520)
      	at cjm.a(SourceFile:296)
      	at cjc.c(SourceFile:839)
      	at cjc.a(SourceFile:378)
      	at net.minecraft.client.main.Main.main(SourceFile:143)
      

            boq [Mojang] Bartosz Bok
            pokechu22 [Mod] Pokechu22
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: