ClearList()
Syntax
ClearList(linkedlist())Description
Clears all the elements in this list and releases their memory. After this call the list is still usable, but the list is empty (i.e. there are no elements in it).
Parameter:
linkedlist() - The name of your linked list variable, created with the NewList command. You must specify the brackets after the list name.
Return value: This command does not return a value.
Example:NewList numbers.w() ; A small loop to add many items to the list For i=1 To 100 AddElement(numbers()) numbers() = i Next ; Proof that items have been added to the list MessageRequester("Information", "There are "+Str(CountList(numbers()))+" elements in the list", #PB_MessageRequester_OK) ; Clear the list and show that the list really is empty ClearList(numbers()) MessageRequester("Information", "There are "+Str(CountList(numbers()))+" elements in the list", #PB_MessageRequester_OK)
Note:
PureBasic will only free the memory for the elements. If you have been using the linked list for something such as storing handles of objects that you create directly with the OS, there is no way PureBasic (or any other language) can know what they are. Therefore, in cases such as that, you should go through the elements in the list and free the objects yourself.
Supported OS
All