next up previous contents
Next: 2.3.4 Naming Up: 2.3 Variables Previous: 2.3.2 Opening

2.3.3 Closing

   

The CDF library automatically closes the variable files in a multi-file CDF when the CDF itself is closed by an application.gif Variable files are also closed automatically by the CDF library as other variables are accessed if insufficient file pointers exist to keep all of the variables open at once. This would be due to an open file quota enforced by the operating system being used.

A case also exists where it may be beneficial for an application to close a variable in a multi-file CDF. Since each open variable file uses some number of cache buffers, a large amount of system memory could be in use (see Section 2.1.4). This may not be a problem on VAX or UNIX machines but could result in a program crashing on an MS-DOS machine. If memory is limited, an application may want to close variables after they have been accessed in order to minimize the total number of cache buffers being used. In a C application rVariables are closed using either the CDFvarClose function (Standard Interface) or the <CLOSE_,rVAR_> operation of the CDFlib function (Internal Interface). zVariables are closed using the <CLOSE_,zVAR_> operation of the CDFlib function (Internal Interface). In a Fortran application rVariables are closed using either the CDF_var_close subroutine (Standard Interface) or the <CLOSE_,rVAR_> operation of the CDF_lib subroutine (Internal Interface). zVariables are closed using the <CLOSE_,zVAR_> operation of the CDF_lib subroutine (Internal Interface).

The closing of variables does not apply to single-file CDFs since individual files do not exist for each variable.



cdfsupport@nssdca.gsfc.nasa.gov