Wanna tips of memory usage

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

I’m in the beggining of the development of a 2d jrpg like ff6 of snes for mobile, even through the game is only now ~5% developed, it already takes ~80K of memory, this is not much for a complete game but it’s still in the begining, so I fear the game can start having memory issues later.

what I need is a basic ‘package’ of tips of how manage better the memory in godot, for example:

calling get_node(“node”) a bunch of times for the same node takes more memory than creating a reference for it?

what is better: calling the instances of a node and adding it to the tree and deleting them from the tree after, or put in the editor all scenes at once, because after load the scene it will take memory usage anyway(or its possible ‘unload’ it from its reference?

Does ending the scene(which the script belongs to it) will cause the scene loaded to disapear too? (and them freeing space)

What other ‘simple’ good pratices i can use in godot for not consume memory?

I assume you mean RAM with memory and not diskSpace.

Concerning your scene Problem, look at that thread: https://forum.godotengine.org/22328/how-to-optimize-memory-usage

Otherwise, use the monitoring systems that are available in godot, to see when the RAM usage goes up.
Also keep in mind that sprites eat up a lot up RAM.
But as far as I know most smartphones have more than 1Gb of RAM, so 80K should never be a problem.

Also keep in mind that premature optimaztation can be misleading, time consuming and might result in a minisculeamount of peroframce gained. So don’t overdue it.
If all else fails, start using GdNative for the parts that you are performance bottlenecks.

coffeeDragon | 2018-06-08 14:07

Thankyou very much my friend, sorry for answer so late, I’ll take your advice

ineedle | 2018-07-09 10:33