LukasBanana / LLGL

Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal
BSD 3-Clause "New" or "Revised" License
2.05k stars 139 forks source link

Fixed large memory leaks in the Metal sample programs #57

Closed beldenfox closed 4 years ago

beldenfox commented 4 years ago

The sample programs were leaking memory on every frame because autorelease pools were not being created or drained so Metal objects were not being released. I added a DrawNow call to the RenderContext to give the platform context an opportunity to set up the correct environment for drawing and clean up after the drawing is done.

I also added an autorelease pool inside OnProcessEvents and fixed a bug in MTEncodeScheduler that was leaking copied RenderPassDescriptors.

LukasBanana commented 4 years ago

Thanks for the update. I can test this on my Mac tomorrow.