Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Memory usage-does size of event queue effect available memory for the script?

Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
03-02-2006 16:22
Hi,

Can I assume the number of events queued up for a script (e.g. listens, link messages, timers - I understand only one thing gets run at a time within a script) does NOT affect memory usage.

That is, if I'm pretty sure I have no memory leaks, and that I don't have lists which grow within the design of the script, and the steady state memory usage is say 3000 availble bytes under light load, THEN can I assume under heavier load this will NOT change, as the only difference will there will be extract events queued up?

Tks
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
03-03-2006 08:35
I'm very tempted to give you the very flippant answer of "you can assume whatever you like" for which I apologise.

I think this is something that you probably need Strife, Kelly or Andrew to answer - but it is my understanding of everything I've seen written, events in the queue don't take memory. I'll see if I can do a test to prove this or otherwise.
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
03-03-2006 13:45
thanks Eloise - I'm crossing my fingers that it doesn't - I'm not sure how I manage to compensate for this otherwise

Strife - know offhand the answer?
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
03-04-2006 10:07
OK, the answer seems to be it uses some for the first one, but not thereafter. 13 bytes in fact, although I only tested one event.

I put this script in an object:
CODE

default
{
collision_start(integer num)
{
llSay(0, (string)llGetFreeMemory());
llSleep(5.0);
}
}

And shot it lots!
The output was as follows:
CODE

Object: 16134
Object: 16121
Object: 16121

I reset it and got this...
CODE

Object: 16134
Object: 16121
Object: 16121
Object: 16121


I changed the script thus:
CODE

default
{
state_entry()
{
llListen(0, "", llGetOwner(), "");
}
collision_start(integer num)
{
llSay(0, (string)llGetFreeMemory());
llSleep(5.0);
}
listen(integer chan, string name, key id, string msg)
{
llSay(0, "listened "+(string)llGetFreeMemory());
}
}


and got this:
CODE

You: unsafe
Object: listened 15901
Object: 15883
You: boo
Object: listened 15871
Object: 15883
Object: 15883
Object: 15883
You: unsafe
Object: listened 15871

Boo was during the sleep
Unsafe and safe weren't...

So, it looks to me, with the tools available, that it chews up some memory with the event queue, although it could be something else chewing up all 13 bytes, like the first function call?
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
03-04-2006 12:09
thanks Eloise - well it looks reasonably promising then - at least there's no ongoing drain of bytes occuring

I've had some memory usage issues with some scripts, but if I can now break out the couple of lists that do change in size due to the nature of the system into a separate script, then I should be able to stabilise the main controller script to a steady state memory usage value then. The controller script does take all the input, so I was wondering whether the queuing could have been a factor

Tks
Greg