A passage in WWI 20.2 Memory limitations discusses this in more detail. The use option dynamic memory allocation of at least
seems to be linked to MEMORY_HEAP_SIZE
indirectly, in that the latter is the former rounded up to the nearest power of two. I had seen this, but it didn’t seem to be directly related in the generated code – the compiler must take notice, however.
Whatever value one gives will be directly set to constant ‘DynamicMemoryAllocation’, e.g.:
Use dynamic memory allocation of at least 10000.
will result in:
! Use option:
Constant DynamicMemoryAllocation = 10000;
but will also result in:
! ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
! Output.i6t: Block Values
! ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
#ifdef TARGET_ZCODE;
Constant MEMORY_HEAP_SIZE = 16384;
#ifnot;
Constant MEMORY_HEAP_SIZE = 65536;
#endif;
due to rounding up.
The default value is 8192, and it seems like lesser values are ignored, which means that the only functionally available choices for Z-Machine are 8192 or 16384.
I didn’t think that DynamicMemoryAllocation
and MEMORY_HEAP_SIZE
were related because there’s no obvious connection in generated code. The most directly affected value is that for BLOCKV_STACK_SIZE
– but only for Glulx.
! ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
! Output.i6t: Global Variables
! ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
...
#ifdef TARGET_ZCODE;
Constant BLOCKV_STACK_SIZE = 224;
#ifnot;
Constant BLOCKV_STACK_SIZE = DynamicMemoryAllocation/4;
#endif;