June 15, 20187 yr 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?
June 15, 20187 yr 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.
June 15, 20187 yr 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
June 15, 20187 yr Author 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?
Create an account or sign in to comment