[JASS] Arrays

Status
Not open for further replies.
Level 6
Joined
May 7, 2009
Messages
228
Do arrays take up space for the full 4096 elements, even if you don't use them?

For example, suppose you had an array, but you only used the first 6 values. Would it still take up 16kb worth of space?

If so, is it better to combine arrays to use less space? For example, instead of using 7 arrays with 6 elements each, use one array with 42 elements?
 
8191 elements to be precise.

And it's pretty unclear to me if it allocates memory for all elements from the start. Some say it drectly uses 8191 elements (32kb), others say that it's allocated in chunks of 256 (2kb)...

32kb isn't a big deal anyway. Nothing compared to what 1 leak does in a periodic trigger.
 
It actually allocates the closest 2 to power of n. ex: 1,2,4,8,16,32,64,128...

And there are 8192 slots, you also have to count the 0.
 
Status
Not open for further replies.
Back
Top