Jump to content

Reducing memory footprint


Laurent Vesta
 Share

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

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

Recommended Posts

Hello.

I wrote a script that collects various data about the region and save those stats in lists. It runs a timer every 10 seconds to collect data. It also servers as a web server receiving HTTP requests and posting responses and also processes touches.

I've been monitoring the free memory to my script. When compiled with Mono, it has less than 1K and after a few iterations of the counter, I get heap collisions. Since I can't find any way of dumping these stats somewhere, I have to keep them in memory.

I'm guessing its those stats in lists that are using memory. Are there any way to reduce memory footprint?

In the mean time, I recompiled the script under LVL (?). The script has now more free memory but I know that's not a long term solution.

Any idea what I could do?

Link to comment
Share on other sites

The two broad categories of solutions are a) find somewhere better to dump the data, or b) compress the data.

In category a, you mainly have Email and Key-Value-Pairs as viable dump-spots (Edit: or auxiliary scripts). In category b, there are a few simple compression functions @Mollymews  recently posted in the LSL examples section:

 

Edited by Quistess Alpha
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Laurent Vesta said:

Hello.

I wrote a script that collects various data about the region and save those stats in lists. It runs a timer every 10 seconds to collect data. It also servers as a web server receiving HTTP requests and posting responses and also processes touches.

I've been monitoring the free memory to my script. When compiled with Mono, it has less than 1K and after a few iterations of the counter, I get heap collisions. Since I can't find any way of dumping these stats somewhere, I have to keep them in memory.

I'm guessing its those stats in lists that are using memory. Are there any way to reduce memory footprint?

In the mean time, I recompiled the script under LVL (?). The script has now more free memory but I know that's not a long term solution.

Any idea what I could do?

Curious what byte code and stored data about a region would heap a script after just a few iterations.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Laurent Vesta said:

When compiled with Mono, it has less than 1K

1 hour ago, Laurent Vesta said:

I recompiled the script under LVL (?). The script has now more free memory

A mono script can use 64k and a LSL script can use 16k - the 2 statements are not possible.

Except you have a useless llSetMemoryLimit somewhere since that has no effect under LSL. That would be a "shot yourself in the foot" thing.

Edited by Nova Convair
  • Like 1
Link to comment
Share on other sites

I guess the first question would be how much data do you want to store.
If you want to store all sim statistics into a list every 10 seconds then you either have to remove the oldest ones from your list when you run out of memory (better then script crash) or store them somewhere else.

Again depends on the amount of data. If you can fill up a script with data in 1 day you can either add something like 100 scripts to your object as storage or you will have to store it in a remove database.

Link to comment
Share on other sites

1 hour ago, Nova Convair said:
3 hours ago, Laurent Vesta said:

I recompiled the script under LVL (?). The script has now more free memory

A mono script can use 64k and a LSL script can use 16k - the 2 statements are not possible.

The correct terms are Mono and LSO. They are both LSL, which stands for "Linden Scripting Language."

Also, while Mono scripts have four times the memory capacity, things also take up about four times as much memory.

3 hours ago, Laurent Vesta said:

Since I can't find any way of dumping these stats somewhere, I have to keep them in memory.

I'm guessing its those stats in lists that are using memory. Are there any way to reduce memory footprint?

You can assign an empty list (stats = [];) to your list of stats to remove them from memory. There are also functions like llDeleteSubList to remove parts of a list.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 956 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...