Creating and Destroying Foreign Terms

Prolog can create or destroy foreign terms using

         new(+Type, -Datum),
         new(+Type, +Size, -Datum) and

where Type is an atom specifying what type of foreign term is to be allocated, and Datum is the foreign term. The Datum returned by new/[2,3] is not initialized in any way. dispose/1 is a dangerous operation, since once the memory is disposed, it may be used for something else later. If Datum is later accessed, the results will be unpredictable. new/3 is only used to allocate arrays whose size is not known beforehand, as defined by array(Type), rather than array(Type,Size).