yfoo Posted June 15, 2018 Share Posted June 15, 2018 1. I've notived that static variables seem to persist after restarting a script. Would setting these variables to null under onExit() wipe them for the next time the script is started? 2.) Are static variables shared among different instances of the same script? If I use a static to make a global variable, is that variable global to every running instance of a script or just that specific instance? Quote Link to comment Share on other sites More sharing options...
Impensus Posted June 15, 2018 Share Posted June 15, 2018 19 minutes ago, PayPalMeRSGP said: 1. I've notived that static variables seem to persist after restarting a script. Would setting these variables to null under onExit() wipe them for the next time the script is started? 2.) Are static variables shared among different instances of the same script? If I use a static to make a global variable, is that variable global to every running instance of a script or just that specific instance? 1. Yes if you were to change the value of the variable that persists then of course it will retain the null value for next time the script is started. 2. The variable would be script specific for a given instance unless you coded it to be shared amongst scripts that were connected in some way. 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted June 15, 2018 Share Posted June 15, 2018 21 minutes ago, PayPalMeRSGP said: 1. I've notived that static variables seem to persist after restarting a script. Would setting these variables to null under onExit() wipe them for the next time the script is started? 2.) Are static variables shared among different instances of the same script? If I use a static to make a global variable, is that variable global to every running instance of a script or just that specific instance? https://stackoverflow.com/questions/453023/are-static-fields-open-for-garbage-collection 1 Quote Link to comment Share on other sites More sharing options...
yfoo Posted June 15, 2018 Author Share Posted June 15, 2018 23 minutes ago, Chris said: https://stackoverflow.com/questions/453023/are-static-fields-open-for-garbage-collection If a script is terminated are its resources open for garbage collection assuming I didn't do something that caused a memory leak? Quote Link to comment Share on other sites More sharing options...