Memory allocation: Difference between revisions

Content added Content deleted
m (BBC BASIC moved to the BASIC section.)
Line 219: Line 219:
The optional second parameter to Buff() allows you to specify the byte to be filled with (default is zero).
The optional second parameter to Buff() allows you to specify the byte to be filled with (default is zero).


=={{header|BBC BASIC}}==
=={{header|BASIC}}==
===Heap===
==={{header|BBC BASIC}}===
====Heap====
<syntaxhighlight lang="bbcbasic"> size% = 12345
<syntaxhighlight lang="bbcbasic"> size% = 12345
DIM mem% size%-1
DIM mem% size%-1
PRINT ; size% " bytes of heap allocated at " ; mem%</syntaxhighlight>
PRINT ; size% " bytes of heap allocated at " ; mem%</syntaxhighlight>
Memory allocated from the heap is only freed on program termination or CLEAR.
Memory allocated from the heap is only freed on program termination or CLEAR.
===Stack===
====Stack====
<syntaxhighlight lang="bbcbasic"> size% = 12345
<syntaxhighlight lang="bbcbasic"> size% = 12345
PROCstack(size%)
PROCstack(size%)