Previous: NF90_INQ_VLEN, Up: Variable Length Array


5.7.3 Releasing Memory for a Variable Length Array (VLEN) Type: NF90_FREE_VLEN

When a VLEN is read into user memory from the file, the HDF5 library performs memory allocations for each of the variable length arrays contained within the VLEN structure. This memory must be freed by the user to avoid memory leaks.

This violates the normal netCDF expectation that the user is responsible for all memory allocation. But, with VLEN arrays, the underlying HDF5 library allocates the memory for the user, and the user is responsible for deallocating that memory.

Usage

       function nf90_free_vlen(vl)
         character (len = *), intent(in) :: vlen
         integer :: nf90_free_vlen
       end function nf90_free_vlen
VL
The variable length array structure which is to be freed.

Errors

NF90_NOERR
No error.
NF90_EBADTYPE
Can't find the typeid.

Example