Affects Version/s: Minecraft 1.10.2
Fix Version/s: Minecraft 16w41a
Security Level: Minecraft - Public (Viewable by everyone)
NVIDIA + Linux
There is an OpenGL leak in the View Frustum and subsequently all individual Chunk Renderers + Vertex Buffers.
Without digging too deeply I believe this leak is either 1) a regression or 2) only now obvious due to the use of VBOs by default, which (on NVIDIA + Linux at least) have an allocation time that grows exponentially as more and more buffers are already allocated.
To attempt to reproduce this issue, first enable VBOs. Then join a world and fly around causing lots of chunks to be loaded. Disconnect from the world and repeat this process. After perhaps half a dozen repetitions, the world load time will be very slow (up to 2000ms above normal time has been observed). Note that at this point disabling use of VBOs will restore normal world load time (and toggling them back on will make the issue apparent once more).
The cause of this is that when resetting the Global Renderer on world join, the View Frustum is nulled out before the cleanup method (guarded by a null check) can be run. To fix this leak the cleanup method must be called the line before the View Frustum is nulled out.
Once this additional cleanup is called world load time remains constant even with the use of VBOs.
I have based my terminology on the MCP namings, A patch with hopefully sufficient context is below: