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.
To save the user the trouble calling free() on each element of the VLEN array (i.e. the array of arrays), the nc_free_vlens function is provided. It frees all the vlens in an array.
int nc_free_vlens(size_t len, nc_vlen_t vlens[])
len
vlens
NC_NOERR