ds_priority_destroy

This function will remove the given priority queue data structure from memory, freeing up the resources it was using and removing all values that it contained. This function should always be used when you are finished using the DS priority queue to prevent memory leaks that can slow down and crash your game.

NOTE You should always set the variable that held the data structure reference to -1 after calling this function, since the reference will no longer be valid.

 

Syntax:

ds_priority_destroy(id);

ArgumentTypeDescription
idDS PriorityThe priority queue data structure to remove.

 

Returns:

N/A

 

Example:

if (lives == 0)
{
    ds_priority_destroy(AI_queue);
    AI_queue = -1;
    room_goto(rm_Menu);
}

The above code will check the value of the built in global variable lives and if it is 0, it destroys the DS priority queue referenced in the variable AI_queue and then changes rooms.