Skript Memory Usage

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Cybers_

Member
Feb 21, 2017
18
2
0
Hi, just wondering if anyone knows how skript handles memory usage, although the server only has around 1,000 loaded variables, over 4~ hours the free memory gradually decreases and eventually starts reaching 0mb causing a severe lag spike. The majority of the server is skript so it can't be to do with the actual code, but the only thing I can think is it's something to do with the variables. I have a lot of variables that get created and then deleted, but when skript clears the data, does it clear the ram as well? If that's the case then there's potentially 100,000+ that get created and deleted over 4 hours which would explain it, and when the server restarts everything runs smoothly.

https://gyazo.com/f74efb00face65ab0798eeb9f000a984

This is with 3 hours server uptime and only 30 players online, it doesn't make sense for the memory to drop this low.
 
Last edited:
Are you contantly updating or adding and removing variables? Can you share your code? Or any code that constantly runs in like a while loop or periodic event? (every X seconds)
 
Hi, just wondering if anyone knows how skript handles memory usage, although the server only has around 1,000 loaded variables, over 4~ hours the free memory gradually decreases and eventually starts reaching 0mb causing a severe lag spike. The majority of the server is skript so it can't be to do with the actual code, but the only thing I can think is it's something to do with the variables. I have a lot of variables that get created and then deleted, but when skript clears the data, does it clear the ram as well? If that's the case then there's potentially 100,000+ that get created and deleted over 4 hours which would explain it, and when the server restarts everything runs smoothly.

https://gyazo.com/f74efb00face65ab0798eeb9f000a984

This is with 3 hours server uptime and only 30 players online, it doesn't make sense for the memory to drop this low.

Please use the spigot timings , are really more specific and we can see what event make your server overloading.
 
Are you contantly updating or adding and removing variables? Can you share your code? Or any code that constantly runs in like a while loop or periodic event? (every X seconds)
There's no variables used in a loop or while, but mostly just temporary variables that I can't use a local variable for.

https://hastebin.com/atojazikiw.css - this is a portion of the deleted variables on .csv.

https://hastebin.com/yijineyono.vbs - this is what the playertrack variable is used for

the "place.blocks" "block." "broken.blocks" are used for regenerating blocks that a player places, so they are set whilst they are alive, and deleted when they die

all the "duel." variables are used for duels, sending a request, then setting it to .ingame and adding both of them to a list variable so that at the end of the duel I can check that they were in a duel together.

"team." variables are for party invites/duels

and the rest of the variables are mostly ones that I load in from the database and keep in as a variable, but only get deleted when they leave the server.

There's probably a few things I could recode to reduce variables because this is most old code that I made from 1 year ago
[doublepost=1489427347,1489426604][/doublepost]Here is a timings whilst the server is running fine just after restarting - https://timings.spigotmc.org/?url=xujahetiva
Don't know if that will help, but it shows that skript isn't the cause for it at least. I'll try and extend the auto-restart time so that I can grab a timings when the memory starts to hit 0mb.
 
@Cybers_

You can use yaml storage for use 0 variables into the server.

code_language.skript:
set yaml value "Kills.%uuid of player%" from file "plugins/FolderName/Filename.yml" to ("0" parsed as number)
set {_kills} to yaml value "Kills.%uuid of player%" from file "plugins/FolderName/Filename.yml"
delete yaml value "Kills.%uuid of player%" from file "plugins/FolderName/Filename.yml"
 
@Cybers_

You can use yaml storage for use 0 variables into the server.

code_language.skript:
set yaml value "Kills.%uuid of player%" from file "plugins/FolderName/Filename.yml" to ("0" parsed as number)
set {_kills} to yaml value "Kills.%uuid of player%" from file "plugins/FolderName/Filename.yml"
delete yaml value "Kills.%uuid of player%" from file "plugins/FolderName/Filename.yml"
There's a few variables like kills, deaths etc. that I will be able to use always from the database, so they should be fine, but they only delete when a player leaves atm, I'm probably going to remove the block regenerating variables to save space, and I've remove the arena::, and nodmg:: variables. So the main one I think I have a problem with is the playertrack:: variable which tracks every player that hits another player and then deletes it after 20 seconds, how could I improve that?
 
@Cybers_ Just start the timings , loop the variables with a command and at least see the timings schedule.
 
Status
Not open for further replies.