Task

Show how to explicitly allocate and deallocate blocks of memory in your language.

Show access to different types of memory (i.e., heap, stack, shared, foreign) if applicable.




/* Maxima allocates memory dynamically and uses a garbage collector.
Here is how to check available memory */
 
room();
  3221/3221   72.3%       2 CONS RATIO COMPLEX STRUCTURE
   272/307    61.6%         FIXNUM SHORT-FLOAT CHARACTER RANDOM-STATE READTABLE SPICE
   226/404    90.8%         SYMBOL STREAM
     1/2      37.2%         PACKAGE
   127/373    44.9%         ARRAY HASH-TABLE VECTOR BIT-VECTOR PATHNAME CCLOSURE CLOSURE
   370/370    49.1%       1 STRING
   325/440     8.2%         CFUN BIGNUM LONG-FLOAT
    31/115    98.9%         SFUN GFUN VFUN AFUN CFDATA
  1188/1447                 contiguous (478 blocks)
       11532                hole
       5242    5.0%         relocatable
      4573 pages for cells
     22535 total pages
     97138 pages available
     11399 pages in heap but not gc'd + pages needed for gc marking
    131072 maximum pages