SRL Archive - OSR Help

Freeing DTM's. I thought I did it right , I guess not


tifalynn

2013-04-11 12:29:39

procedure ScriptTerminate;
var
i: integer;
begin
for i := 1 to 9 do
FreeBitmap(DTM[i]);
Disguise(' end ');
end;

The following DTMs were not freed: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19].

I thought this was to be how to free them but I'm having problems still, after my first run.
so assuming I'm not doing right, help would be appreciate.
Is not there a procedure to free all DTM's instead of specific one?

Apologize for grammar. Not English first. Thanks very much for help!

:: Confuses me such more for my friend uses same script and has not issues.
I'm pretty sure my client is up to day I think, and my other things.
I can only successfully run once for a while, before problems. Only 4 Successful uses so far, out of many. After first success then no good performance.

Olly

2013-04-11 12:33:06

your calling freeBitmap, which free's bitmaps not DTMs. :p use freeDTM(dtm) :)

iirc there is a function in srl5 called "freeDTMs" that accepts a TIntegerArray of dtms.

Turpinator

2013-04-11 12:38:34

SRL has some DTMs that are loaded when you setup srl, if i recall correctly. I get this some times too.

Oh. on second look it appears as if you are using freebitmap to free a DTM. Switch that over to FreeDTM(DTM);

Also you may want to, as the script is starting up use AddOnTerminate('ScriptTerminate'); to automatically run that function when the script terminates, whether normally or unexpectedly.

tifalynn

2013-04-11 12:40:38

ah. that make sense. Though if my script use Bitmap that need to be freed too, would this break it?

Does my problem correlate with issue? Like I get success a few times. 2, maybe even 3 rarely, loops(?) but then misfunction

Thanks so far!

tifalynn

2013-04-11 12:46:29

From: Ollybest
your calling freeBitmap, which free's bitmaps not DTMs. :p use freeDTM(dtm) :)

iirc there is a function in srl5 called "freeDTMs" that accepts a TIntegerArray of dtms.


Not sure how I missed this.
I think by changing that its functioning now. Lower failure rates!
^_^.

Rich

2013-04-11 13:39:52

From: tifalynn
ah. that make sense. Though if my script use Bitmap that need to be freed too, would this break it?

Does my problem correlate with issue? Like I get success a few times. 2, maybe even 3 rarely, loops(?) but then misfunction

Thanks so far!
I think you're asking if you'd need to free the bitmaps as well as the DTMs, and the answer to that is yes. By not freeing the DTMs and bitmaps you'll be unnecessarily using memory, slowing your PC down.