Dispose of graphics resources deterministically

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.

This PR ensures almost all of these resources are released deterministically via Dispose (a few stragglers still get finalized since some lifetimes are non-trivial, particularly with textures for sheets allocated by sheet builders, which makes tracking them down difficult).

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.
No, I meant regardless of your changes. Why call this instead of the Sheet ctor?

-------- Original message --------
From: RoosterDragon <notifications@github.com> 
Date: 11/07/2014  21:25  (GMT+02:00) 
To: OpenRA/OpenRA <OpenRA@noreply.github.com> 
Cc: Pavlos Touboulidis <pav@pav.gr> 
Subject: Re: [OpenRA] Dispose of graphics resources deterministically (#5923) 
 
In OpenRA.Game/Graphics/SheetBuilder.cs:

>  
> -		public static Sheet AllocateSheet()
> +		public static Sheet AllocateSheet(int sheetSize)
I think I tweaked in the parameter in hopes of removing some of the calls to Game.Renderer in other areas but it didn't pan out. I guess I could simplify things a bit by hardcoding that back in again.

Unless you were suggesting there's a way to rid ourselves of it entirely?

—
Reply to this email directly or view it on GitHub.