Stack Management Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > STK. - Stack > STK.-Management >

Stack Management Commands

STK.End - Delete Stack and Invalidate Handle

Previous Top Next


MiniRobotLanguage (MRL)

 

STK.End

Delete Stack and Invalidate Handle

 

 

Intention

 

STK.End is used to delete a previously created stack. This command removes all data stored in the stack and releases the memory associated with it. After this operation, the stack handle becomes invalid and can no longer be used.

This is a critical command for managing memory in applications that use dynamic stacks. It prevents memory leaks by ensuring unused stacks are properly deleted.

Once a stack is deleted using STK.End, attempting to use its handle in any stack operation will result in an error.

 

Syntax

 

STK.End|$$STK

 

Parameter Explanation

$$STK - Handle of the stack to delete. Once deleted, this handle becomes invalid and cannot be used again.

 

Example

' Create a stack and then delete it

STK.New|$$STK|i

STK.End|$$STK

 

Remarks

Always ensure that unused stacks are deleted using STK.End to avoid wasting memory.

 

Limitations:

- Using an invalid handle after deletion will cause an error.

 

See also:

STK.New