manuallyDestroyVariable (object --)
Inputs
object: Object or Ref object whose designated object is destroyed.
Outputs
- None.
manuallyDestroyVariable is a designated-storage destruction builtin. It destroys an object in existing storage. Storage release or storage reuse is a separate operation. For a non-static, non-callable In-place local or field, NAME or .NAME and @NAME or .@NAME all designate the same storage for manual destruction; see selection.
Behavior
- If
objectis a mutable or immutableRef, the builtin destroys the object in the referenced storage. - Otherwise, it destroys the designated local, field, or temporary object itself.
- The builtin does not free the underlying storage address.
Example
"String" use
"memory.mplMalloc" use
Tracer: {
value: 0;
INIT: [
("init\n") printList
42 !value
];
DIE: [
("die\n") printList
];
};
{} 0 {} [
slot: Tracer storageSize mplMalloc @Tracer addressToReference;
@slot manuallyInitVariable
("-- value -- " slot.value "\n") printList
slot manuallyDestroyVariable
0
] "main" exportFunction
Expected Output
init
-- value -- 42
die
See also
addressToReferencebuiltin(address modelValue -- reconstructedValue)Typed reconstruction from a numeric storage address. Ref-like model objects keep their schema, and direct non-Ref-like model objects produceRefresults.alignmentbuiltin(schema -- alignment)KnownNatxalignment requirement of the dereferenced schema.manuallyInitVariablebuiltin(object --)Manually initializes the designated object in existing storage without allocating the storage.storageAddressbuiltin(object -- address)Current stack-object storage query; knownNILRef,Text, andCodeobjects produce0nx.storageSizebuiltin(schema -- size)KnownNatxstorage size of the dereferenced schema.