next up previous 264
Next: AST Pointer Contexts Begin and End
Up: An AST Object Primer
Previous: Transforming Coordinates


Managing Object Pointers

So far, we have looked at creating Objects and using them in various simple ways but have not yet considered how to get rid of them again.

Every Object consumes various computer resources (principally memory) and should be disposed of when it is no longer required, so as to free up these resources. One way of doing this (not necessarily the best--[*]) is to annul each Object pointer once you have finished with it, using AST_ANNUL. For example:

      CALL AST_ANNUL( ZOOMMAP, STATUS )

This indicates that you have finished with the pointer and sets it to the null value AST__NULL (as defined in the AST_PAR include file), so that any attempt to use it again will generate an error message.

In general, this process may not delete the Object, because there may still be other pointers associated with it. However, each Object maintains a count of the number of pointers associated with it and will be deleted if you annul the final pointer. Using AST_ANNUL consistently will therefore ensure that all Objects are disposed of at the correct time. You can determine how many pointers are associated with an Object by examining its (read-only) RefCount attribute.


next up previous 264
Next: AST Pointer Contexts Begin and End
Up: An AST Object Primer
Previous: Transforming Coordinates

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council