Is there a queue_free() or free() for Resources like Images?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By exuin

Like, I have a script that makes an image and assigns it to a local variable in a function. But after I save the image to a file, how do I get rid of it, since I don’t need it anymore? Will it just disappear after the function is over?

Edit: Why the downvote? Is my question really that stupid?

:bust_in_silhouette: Reply From: klaas

Hi,
your question is not that stupid.

Resources are reference counted. That means if you dont hold any reference anymore they will be freed.
Holding a reference is assigning it to a variable. So if you delete anything pointing to it, its gone.

Reference
Inherits: Object

Base class for anything that keeps a reference count. Resource and many other helper objects inherit this. References keep an internal reference counter so they are only released when no longer in use.

Okay, thanks for explaining! I really appreciate it!

exuin | 2020-09-23 08:04