cleanup allocated memory for texture2D

I’m wondering if you create a new Texture2D and fill it up with something and then later recreate them and fill them up again, how do you release the memory allocated the previous time? So if for example you want to keep the same name but recreate the texture with new dimensions. I’m writing a rather lengthy routine but this is a problem i have, as my application eventually crashes. If i create the Texture2D only once this problem doesn’t occur. So i can only conclude that if you construct a new Texture2D… memory is allocated at some point but if you then construct it again with other dimensions somehow there’s a need to cleanup the memory previously allocated but i don’t see a clear way to do this.

Does this make any sense, and if so what can be done about it?

What language are you using? In C# you rely on garbage collection to free up memory and it does it when it feels like it. Best you can do is make sure all references to it have been destroyed. I have a feeling, however that something you’re doing is extremely inefficient if that’s your problem but unless you post code and explain more it’s impossible to know.