I've only heard of it and haven't had any errors concerncing this yet. So how big is the limit we can use for code, especially (array) variables?
The limit is supposed to be 2mb, but I am not sure how variables, script itself, banks, databases,... sum up to this limit. So I am basically fearing that I will need a lot of int variables to set up levels and lots of other stuff.
Compare it to the JASS limits (were there even any concerning memory limit?), there we could have tons of arrays (a single struct had 2 (or 3?) arrays even without any members)
For example one in is 4 bytes large.
So 256 integer variables (no matter what value they hold) amount to 1kb of memory.
So basically you can have 524,288 int variables until the memory limit is reached.
Now, different variable types have different size.
A boolean only has a size of 1 byte.
I don't know about a Real, but it might be 48 bytes (I don't know how much it can hold).
Strings are different, though. They would usually require a dynamic amount of memory because their length varies, but that doesn't seem to be the case. They always seem to require a fixed amount of size. I don't know how much though.
Arrays will, of course, require the amount of memory for all fields combined. So an array with max size of 200 will require 200 times as much memory as a non-array variable of the same type.
Your script counts too, however only the size of the processed script code, which is less than what you actually write.
What counts towards the maximum limit:
Script code (GUI and Galaxy of course), variables, Strings (somewhat)
What doesn't:
Banks, Data Tables, Strings (somewhat)
Good old Warcraft III didn't have a memory limit like this. I'm sure there was one, but it's probably more like 4 GB (minus Warcraft's own requirements).
Hey guys.
I've only heard of it and haven't had any errors concerncing this yet. So how big is the limit we can use for code, especially (array) variables?
The limit is supposed to be 2mb, but I am not sure how variables, script itself, banks, databases,... sum up to this limit. So I am basically fearing that I will need a lot of int variables to set up levels and lots of other stuff. Compare it to the JASS limits (were there even any concerning memory limit?), there we could have tons of arrays (a single struct had 2 (or 3?) arrays even without any members)
For example one in is 4 bytes large.
So 256 integer variables (no matter what value they hold) amount to 1kb of memory.
So basically you can have 524,288 int variables until the memory limit is reached.
Now, different variable types have different size.
A boolean only has a size of 1 byte.
I don't know about a Real, but it might be 48 bytes (I don't know how much it can hold).
Strings are different, though. They would usually require a dynamic amount of memory because their length varies, but that doesn't seem to be the case. They always seem to require a fixed amount of size. I don't know how much though.
Arrays will, of course, require the amount of memory for all fields combined. So an array with max size of 200 will require 200 times as much memory as a non-array variable of the same type.
Your script counts too, however only the size of the processed script code, which is less than what you actually write.
What counts towards the maximum limit:
Script code (GUI and Galaxy of course), variables, Strings (somewhat)
What doesn't:
Banks, Data Tables, Strings (somewhat)
Good old Warcraft III didn't have a memory limit like this. I'm sure there was one, but it's probably more like 4 GB (minus Warcraft's own requirements).