Jump to content

Do stopped scripts remain in memory?


Extrude Ragu
 Share

You are about to reply to a thread that has been inactive for 1090 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I thought that if a script is in an object in-world, and it is not running, it's not using any script resources - It's just a reference to it like any other object inventory item.

However I'm not sure if that is true anymore. I had an object with two scripts, one not running and the other running.

The running one does something like this:-

llSetScriptState("other script", TRUE);
llMessageLinked(LINK_SET, 0, "Spaghetti", NULL_KEY);

And in the second script that is not running just has a simple event handler

link_message(integer sender_num, integer num, string str, key id)
{
  llSay(0, "received " + str);
  llSetScriptState(llGetScriptName(), FALSE);
}

 

What I thought would happen was that, starting the other script with llSetScriptState would take some time, because the server would have to load the script into memory first and that would happen Asyncronously, so calling MessageLinked immediately, I did not expect that the other script would receive this message.

What actually happened was that the other script did receive the message and say it into chat rather fast.

Actually this is useful in that I can start a script, and send messages to it synchronously but what I wondered is if that means that scripts that are not running are still using memory in the simulator?

Link to comment
Share on other sites

From my knowledge, they keep their reserved memory but don't take up any CPU time when not running (or at least, take up the minimum amount possible, which I think is around 0.003ms).

Note that the reserved memory is either the default amount, (16k for LSO, or 64K for Mono), or whatever was last set by llSetMemoryLimit

  • Like 1
Link to comment
Share on other sites

2 minutes ago, Jenna Huntsman said:

From my knowledge, they keep their reserved memory but don't take up any CPU time when not running (or at least, take up the minimum amount possible, which I think is around 0.003ms).

Note that the reserved memory is either the default amount, (16k for LSO, or 64K for Mono), or whatever was last set by llSetMemoryLimit

Mono scripts have dynamic memory, meaning they only reserve as much as they actually use. There's no way for external scripts to measure anything besides the maximum limit, though.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Just now, Wulfie Reanimator said:

Mono scripts have dynamic memory, meaning they only reserve as much as they actually use. There's no way for external scripts to measure anything besides the maximum limit, though.

True. What is reported to any interested parties is always the memory limit, rather than the current (actual) memory size, so if you're stopping scripts to try and get around memory restrictions (e.g. orbs which will kick someone for using X amount of script memory), stopping the script won't work as the reported memory use is still the same as if the script was running.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Jenna Huntsman said:

From my knowledge, they keep their reserved memory but don't take up any CPU time when not running (or at least, take up the minimum amount possible, which I think is around 0.003ms).

I have heard (I think from Simon Linden) that actually stopping a script with llSetScriptState takes it out of the path that uses time on each simulation frame. Scripts just waiting for an event do use time, and somewhere around 5000 to 6000 idle scripts in a sim, use all the simulation time.

You can test this in an empty sandbox.

  • Thanks 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1090 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...