Laurent Vesta Posted September 11, 2021 Share Posted September 11, 2021 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 More sharing options...
Quistess Alpha Posted September 11, 2021 Share Posted September 11, 2021 (edited) 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 September 11, 2021 by Quistess Alpha 1 1 Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted September 11, 2021 Share Posted September 11, 2021 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. 1 Link to comment Share on other sites More sharing options...
Nova Convair Posted September 11, 2021 Share Posted September 11, 2021 (edited) 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 September 11, 2021 by Nova Convair 1 Link to comment Share on other sites More sharing options...
bobsknief Orsini Posted September 11, 2021 Share Posted September 11, 2021 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 More sharing options...
Wulfie Reanimator Posted September 11, 2021 Share Posted September 11, 2021 (edited) 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 September 11, 2021 by Wulfie Reanimator Link to comment Share on other sites More sharing options...
KT Kingsley Posted September 11, 2021 Share Posted September 11, 2021 Is this a situation where you could use running totals and rolling stats instead of storing every item in the script? Also, somewhere in this forum, Innula (I think) has posted a tutorial on using Google Sheets to store data externally from a script... Here: 1 Link to comment Share on other sites More sharing options...
Laurent Vesta Posted September 11, 2021 Author Share Posted September 11, 2021 Thank you guys, I'm going over all the replies and will post my response after I check what was suggested. Glad to see the SL scripting community is still alive and well. Judging from the wiki, you would have a different feeling... Link to comment Share on other sites More sharing options...
Recommended Posts
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