Ran into an oddity with memory usage.
Blarg AS INTEGER[4096,4096]
32 bits * 4096 * 4096 = 536,870,912 bits = 67.108864 MB
I would expect this to use about 67 MB of memory. Upon testing, it does indeed use about 67 MB of memory.
Next, I would expect these to use roughly the same amount of memory:
Multiple vars example:
GLOBAL Blarg1 AS INTEGER[4096,4096]
GLOBAL Blarg2 AS INTEGER[4096,4096]
GLOBAL Blarg3 AS INTEGER[4096,4096]
GLOBAL Blarg4 AS INTEGER[4096,4096]
GLOBAL Blarg5 AS INTEGER[4096,4096]
Type example:
TYPE MemTestType
blarg1 AS INTEGER
blarg2 AS INTEGER
blarg3 AS INTEGER
blarg4 AS INTEGER
blarg5 AS INTEGER
ENDTYPE
GLOBAL Blarg AS MemTestType[4096,4096]
The first example uses 348 MB or memory, the expected amount.
However, the second example uses 1138 MB of memory, about 3.27 times the amount of memory.
Where is all the overhead coming from?
Am I doing something wrong?