DJ Cassio (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))):
(!empty($user->lang['QUOTE'])) ? $user->lang['QUOTE'] : ucwords(strtolower(str_replace('_', ' ', 'QUOTE'))):
Declaration
property MemoryLeakWarning: Boolean;
Description
Read/Write
Default value is False
If MemoryLeakWarning is set to True it will warn you about possible memory leaks.
PAL scripts do automatic garbage collection when the end of the script is reached. (Even if Loop is set to True)
Garabage collection refers to the process of automatically freeing all objects and memory allocated during the execution of the PAL script.
If you have a script that allocated a lot of objects without freeing those objects, you might run into resource problems an cause SAM Broadcaster to crash.
Turning MemoryLeakWarning on might help you find obejcts that are not properly getting freed during the cource of the script.
EXAMPLE SCRIPT - HOW TO USE MEMORYLEAKWARNING
(!empty($user->lang['QUOTE'])) ? $user->lang['QUOTE'] : ucwords(strtolower(str_replace('_', ' ', 'QUOTE'))):
{## This script uses a lot of memory, and never frees it.
After running for a few hours this can start causing problems}
PAL.MemoryLeakWarning := True;
var Q : TDataSet;
var D : DateTime;
{If we made the loop continue for a few hours it will eat up a lot of memory!
For this example we only repeat the loop for 10 seconds}
D := T['+00:00:10'];
repeat
Q := Query('SELECT * FROM songlist ORDER BY date_played DESC LIMIT 10',[],True);
PAL.LockExecution;
Q.First;
while not Q.EOF do
begin
WriteLn(Q['artist']);
Q.Next;
end;
PAL.UnlockExecution;
{## We *should* call this statement here
Q.Free;
}
until Now > D;
Many thanks for the script and info.
I ran the script, but no errors..
The SAM is a backup and not live, but when it crashes it continues to run, but with errors.
I have a couple of scripts which run 24/7, like Twittercast, but are event triggered - like track change, so are in a constant wait state, should those be what I should be looking at?
_________________
Its all about the music..
https://www.1mix.co.uk