MerlinofMines / EasyCommands

Github Repository for Ingame Scripts built by MerlinofMines. Uses MDK to Deploy to SpaceEngineerse
GNU General Public License v3.0
8 stars 3 forks source link

Do not leak `PROGRAM` #230

Closed jgersti closed 2 years ago

jgersti commented 2 years ago

only set PROGRAM during the constructor and Main() and make sure it is unset in a finally block. This is necessary since static variables inside the script class are leaked. In our case this means PROGRAM kept the whole script and potentially cached blocks from being garbage collected.

The tests not using the ScriptTest mechanism are adapted to set PROGRAM appropriately. also includes changed exceptions and some additional char savings.