0 votes

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? :)

in Engine by (307 points)

1 Answer

+2 votes
Best answer

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

by (239 points)
selected by

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?

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

Thanks Raymoo, I accepted this as solved.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.