ds_map_destroy

DS maps take up space in memory, which is allocated to them when they are created. This means that you also need to free this memory when the DS map is not needed to prevent errors, memory leaks and loss of performance when running your game. This function does just that.

NOTE Destroying a map will de-reference any data structures stored in the map giving a memory leak, so you would need to go through the map and destroy all data structure items manually before destroying it to prevent this. The only time this is not required is when you have flagged any items in the map as a DS list or as another DS map, in which case these items will be destroyed and their memory cleaned up automatically as well.

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_map_destroy(id);

ArgumentTypeDescription
idDS MapThe id of the map to destroy.

 

Returns:

N/A

 

Example:

ds_map_destroy(inventory);
inventory = -1;

The above code will destroy the DS map referenced in the variable inventory.