Saving and Restoring Heap Variables
The SAVE and RESTORE procedures work for heap variables just as they work for all other supported types. By default, when IDL saves a pointer or object reference in a save file, it recursively saves the heap variables that are referenced by that pointer or object reference. SAVE handles circular data structures correctly. You can build a large, complicated, self-referential data structure, and then save the entire construct with a call to SAVE to save the single pointer or object reference that points to the head of the structure. For example, you can save a pointer to the root of a binary tree and the entire tree will be saved.
The internal identifier of a given heap variable is dynamically allocated at run time, and will differ between IDL sessions. As a result, the RESTORE operation maps all saved pointers and object references to their new values in the current session.
In some cases, you may want to save the pointer or object reference, but not the heap variable that are referenced by that pointer or object reference. You can specify that the heap variable associated with a pointer or object reference not be saved using the HEAP_NOSAVE procedure or the HEAP_SAVE function. See the documentation for HEAP_SAVE for additional details.