Jump to content
Sign in to follow this  
Polaris

Are local variables destroyed at script termination?

Recommended Posts

I've been wondering this for a while. I've read conflicting answers so I was hoping a BIS developer or someone that knows for sure would be able to comment? I was also wondering, if they're not, is it worth it (especially on the server) to nil all local variables at script termination to stop the system memory from becoming saturated with unnecessary and useless values?

Share this post


Link to post
Share on other sites

They go to script heaven and are uploaded to the great root server, peace be upon it

Share this post


Link to post
Share on other sites
I've been wondering this for a while. I've read conflicting answers so I was hoping a BIS developer or someone that knows for sure would be able to comment? I was also wondering, if they're not, is it worth it (especially on the server) to nil all local variables at script termination to stop the system memory from becoming saturated with unnecessary and useless values?

https://community.bistudio.com/wiki/Variables#Local_Variables

Local variables are only working within a script, they're not available to anything outside of that one script. If the script is terminated/finished, the local variables cease to "exist", if you want it.

Share this post


Link to post
Share on other sites
I was also wondering [...] is it worth it (especially on the server) to nil all local variables at script termination to stop the system memory from becoming saturated with unnecessary and useless values?

Definitely not. Trust me: You will not saturate the system memory with simple script variables. A single texture probably contains more information than all of the script variables you will use combined.

Share this post


Link to post
Share on other sites
Definitely not. Trust me: You will not saturate the system memory with simple script variables. A single texture probably contains more information than all of the script variables you will use combined.

Depends. local variables are as local as one can get. You can probably have a ton of those within a script without noticing any kind of delay except for the execution time it takes to execute the script. With excessive use of publicVariable in very short timeframes you might notice a decrease in bandwidth though.

Share this post


Link to post
Share on other sites

Alright, thank you for the information. I simply wasn't sure what type of performance impact, if any, clearing up variables would have. But I guess it's pretty logical to assume very little considering the quantity of data.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×