What happens when you don't release DTMs or bitmaps that were loaded? Isn't it stupid to load DTMs and release them over and over again, when you could just load them at startup and go on?
Printable View
What happens when you don't release DTMs or bitmaps that were loaded? Isn't it stupid to load DTMs and release them over and over again, when you could just load them at startup and go on?
I had a procedure to load all my DTMs before the mainloop. Then had a procedure that free them all too, and added it into this function.
Simba Code:AddOnTerminate('FreeAllDTMs');
So when the script terminates, it will free my dtms. And I don't need to load and free the dtm everytime in a procedure or function. Well, that's just what I do in my scripts, not sure about others.
if you dont release them eventually it will crash( i learnt the hard way)
Even if you clog up your memory, a simple reboot will clear all that, no?
yes, even restarting the program would theoretically reset the memory cache for it. But while your script is running you will just be chewing away at memory. It will just cause crashing in the long run.
Simba actually release all bitmaps and DTMs automatically when script is terminated. But if you create more and more new bitmaps/dtms when script is running and don't free any you will flood your memory and you can end with error:
Error: Exception: Out of memory at line 22
the reason many people choose to release within each procedure is that if they have alot, eventually they wouldnt be able to load them all at the beginning and release at the end so they just release within each procedure/function in case they add more