> so this may be common wc3 knowledge.
Sort of. Array usage and limits are common wc3 knowledge, but wurst uses an allocator (arrays) which are not free. You haven't asked about that, but I'll give a brief explanation below.
> Googling around revealed that creating a wc3 array will always create one of size 8192.
That used to be true, but in the last year a patch increased this by quite a lot.
> I am wasting 8000+ elements worth of memory?
No. All arrays in jass/wurst use an underlying ArrayList (style of) array. It means that you're only consuming up to 2x the number of members that you've used.
You should also know that - relative to the cost of using jass natives/code - jass arrays are pretty fast/cheap. Even if you allocae 32,000 members in an array, that's still going to be cheaper than some small amount of CreateUnit() calls.
> but wurst uses an allocator (arrays) which are not free.
Wurst classes are not magic. When you do "let m = new MyClass()", you're getting:
- a new, unused pointer (integer), which is actually an index into a set of arrays
- this is why you can cast to int (let z = m castTo int)
- you can run out of allocation space for the MyClass family (too many new MyClass(), not enough destroy m)
Good luck and happy wursting