SRL Archive - OSR Help

Releasing DTMs


litoris

2012-06-01 12:29:03

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?

CephaXz

2012-06-01 12:32:29

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.
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.

Rich

2012-06-01 13:26:50

From: litoris
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?

1) You clog up your memory.

2) Yes.

litoris

2012-06-01 13:39:43

From: Rich
1) You clog up your memory.

2) Yes.


Simba doesn't release DTMs and such when script is terminated right? I will use cephaxz's method I suppose.

Rich

2012-06-01 13:49:38

From: litoris
Simba doesn't release DTMs and such when script is terminated right? I will use cephaxz's method I suppose.
Yup, you have to do it manually.

Mr Stoj

2012-06-01 15:28:12

if you dont release them eventually it will crash( i learnt the hard way)

Le Jingle

2012-06-01 16:15:08

Even if you clog up your memory, a simple reboot will clear all that, no?

serajin

2012-06-01 16:21:37

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.

bg5

2012-06-02 03:21:41

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

bolshak25

2012-06-02 11:59:05

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