FNA-XNA / FNA

FNA - Accuracy-focused XNA4 reimplementation for open platforms
https://fna-xna.github.io/
2.59k stars 262 forks source link

Do a second take of #442 #461

Closed flibitijibibo closed 9 months ago

flibitijibibo commented 9 months ago

Test program:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

class TextureContainer
{
    Texture2D tex;

    public TextureContainer(GraphicsDevice gd)
    {
        tex = new Texture2D(gd, 1, 1);
    }

    ~TextureContainer()
    {
        tex.Dispose();
    }
}

class Program : Game
{
    static void Main(string[] args)
    {
        using (Program p = new Program())
        {
            new GraphicsDeviceManager(p);
            p.Run();
        }
    }

    protected override void Draw(GameTime gameTime)
    {
        new TextureContainer(GraphicsDevice);
        if (gameTime.TotalGameTime > TimeSpan.FromSeconds(10))
        {
            GC.Collect();
        }
        base.Draw(gameTime);
    }
}
thatcosmonaut commented 9 months ago

Fixed by https://github.com/FNA-XNA/FNA/commit/2f8052ff88d3ec3999fd463b5a33370f226eb216