IDL

PTR_FREE

PTR_FREE

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: PTR_FREE is not recursive. That is, if the heap variable pointed at by pointer1 contains pointer2, destroying pointer1 will not destroy the heap variable pointed at by pointer2. Take care not to lose the only pointer to a heap variable by destroying a pointer to a heap variable that contains that pointer.

If you want to destroy heap variables automatically, use IDL's automatic garbage collection feature (see Automatic Garbage Collection).

Syntax


PTR_FREE, P1, ... …, Pn

Arguments


Pi

Scalar or array arguments of pointer type. If the NULL pointer is passed, PTR_FREE ignores it quietly.

Keywords


None.

Version History


5.0

Introduced

See Also


PTR_NEW, PTR_VALID, PTRARR



Notes


This page has no user notes yet. Be the first one!


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2014 Exelis Visual Information Solutions