How can we queue_free a ImageTexture?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wombatTurkey
:warning: Old Version Published before Godot 3 was released.

I’m creating dynamic avatars using a custom viewport and getting its render texture. What do I do with all the extra unused ImageTextures that I generate? :slight_smile:

:bust_in_silhouette: Reply From: raymoo

Resources are reference counted, so if you want them to be freed nicely then just make sure nothing is pointing at it anymore.

So if I store a reference to an imagetexture in a dictionary it’ll stay in memory until that reference in that dictionary is removed? When the dictionary is removed, the imagetexture will be freed automatically?

wombatTurkey | 2017-07-31 15:27

Yes, assuming you don’t have cyclic references involving the texture.

raymoo | 2017-07-31 15:54

Thanks Raymoo, I accepted this as solved.

wombatTurkey | 2017-07-31 15:55