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

The GL debug message callbacks are never freed, causing memory leak warnings


    • Unconfirmed

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

      The GL debug log callback is never freed, which causes LWJGL's allocation tracker to complain when the game exists if it is enabled (which might hide other real memory leaks). This requires glDebugVerbosity to be set to something nonzero in options.txt; however, it defaults to 1 so that is already the case.

      This is the case for both the KHRDebug version and the ARBDebugOutput version.

      Since these callbacks last the life of the game, it probably makes sense to just mark them as non-freed using LWJGLMemoryUntracker (or whatever the thing in MC-133136 is called).

      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: 0x250B0000
      	at org.lwjgl.opengl.KHRDebug.glDebugMessageCallback(KHRDebug.java:356)
      	at cwo.b(SourceFile:1345)
      	at cjc.an(SourceFile:425)
      	at cjc.a(SourceFile:363)
      	at net.minecraft.client.main.Main.main(SourceFile:143)

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