OpenRA/OpenRA — pull request #6830 by RoosterDragon (2014-10-24 17:46:08+00:00)
Title: Dispose of graphics resources deterministically

#5923 is back.

Speculative fix for #5116 by implementing IDisposable on Texture, FrameBuffer and VertexBuffer rather than relying on the finalizer to do the work since the non-determinism of finalization means these resources could be hanging around for an unbounded length of time before being released. I don't have any particular proof that this will fix the out-of-memory issue, it just seems like it could be a possible cause.

To verify, you can stick some console logging in the finalizers for these methods. On bleed you should notice a lot of activity as you load assets (loading, switching mods, choosing maps, starting & ending a game). This PR fixes all but one inconsequential leak as far as I can tell (the leak is the static SheetBuilder in SprintFont, but since the textures are needed forever it hardly matters).