If I reference a variable from another rust script, within a function called once, am I correct in saying the variable is still stored in RAM after the function is called upon. If so, between the size of the variable, the huge amount of memory used on rust strings, and the infrequency of the functions calling, I'd rather it just stay in memory until once converted to RAM when loaded in, than removed from RAM. Is there a way to do this. (It would increase peformance massivly, and variable cannot be defined within rust code, am using a "use arrays::NAME_OF_ARRAY")
#1 time use variable
3 messages · Page 1 of 1 (latest)
Don't think I understand the scenario. Could you write some example code?
As for where stuff is located. const values are inclined at compile time. They aren't variables.
If a binding is static and immutable, its value is likely stored and accessed from the ROM of the executable. Same with string literals (as they are &'static). That may be located in system memory, or may be elsewhere like a harddrive.
Otherwise, it's usually in memory in some form or another.