The PTR_FREE procedure destroys the heap variables pointed at by its pointer arguments. Any memory used by the heap variable is released, and the variable ceases to exist. No change is made to the arguments themselves and all pointers to the destroyed variables continue to exist. Such pointers are known as dangling references. PTR_FREE is the only way that pointer heap variables can be destroyed. If PTR_FREE is not called on a heap variable, it continues to exist until the IDL session ends, even if no pointers remain that can be used to reference it.
Note that PTR_FREE does not recurse. That is, if the heap variable pointed at by
destroy the heap variable pointed at by
. Take care not to lose the only pointer to a heap variable by destroying a pointer to a heap variable that contains that pointer.