18.4.0 released Sep 25, 2023
Purge hash

Purpose: Purge hash table.

purge-hash <hash> [ delete ]

purge-hash deletes all elements from <hash> table that was created with new-hash. Note that it does not free any possibly allocated memory for keys or values (see write-hash).

After purge-hash, the hash is empty and you can use it without calling new-hash again. Note however, that "average-reads" statistics (see get-hash) is not reset - it keeps being computed and remains for the life of the hash.

If you use "delete" clause, then all the internal memory of a <hash> is freed, and you must call new-hash in order to use it again; in this case all statistics are reset.

See memory-handling for more on when (not) to delete memory explicitly like this; the same rules apply as for delete-mem.
Examples
Create hash, put some data in it and then delete the data:
new-hash h size 100
write-hash h key "mykey" value "myvalue"
purge-hash h

See read-hash for more examples.
See also
Hash table
get-hash  
new-hash  
purge-hash  
read-hash  
resize-hash  
write-hash    
See all
documentation


You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a link back to this page (dofollow) - see full license at CC-BY-4.0. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind.