Local variables still causes memory leaks
command /test:
trigger:
set {_i} to 1
set {test} to true
while {test} is true:
add 1 to {_i}
loop 1000 times:
set {_test::%{_i}%::%loop-number-2%} to random number between 1 and 999999999
send "Ram: %total ram - free ram% MB / %total ram% MB"
wait 1 tick
command /stoptest:
trigger:
set {test} to false
ok i found it...
set {_test::%loop-number-2%} to random number between 1 and 999999999 #works
leak
set {_test::%{_n}%::%loop-number-2%} to random number between 1 and 999999999
Working as intended. You're not exiting the trigger until you use /stoptest, thus local variables are not removed. The "fix" you found relies on the script overwriting existing variables instead of creating new ones.
@bensku after type /stoptest RAM memory stays at for example at 2Gb and it will never decrease until the restart.
JVM does not necessarily free RAM to OS, at least not until version 12 (see https://openjdk.java.net/jeps/346). Unless the expressions you use to get information about RAM have confusing names and refer to heap instead of physical memory, this is not an issue with Skript.
@bensku


Alright, now this is looking troubling. Edit: did quick re-release of hotfix, please check if it helped.
@bensku tested, issue still exists. I have no idea why.
Cannot reproduce. I did find a (relatively unlikely) memory leak, but if was fixed by commit 237b3dd.
@TheBentoBox Did you find a way to reproduce this?
No, I just labelled it since it has been sitting for months unlabelled and with no activity, but if we're not going to do anything until someone comes back with reproduction steps then we should probably just let that be reported as a new issue and close this one.
No one has been able to reproduce this with recent Skript versions, so closing.
Most helpful comment
Alright, now this is looking troubling. Edit: did quick re-release of hotfix, please check if it helped.