Freeing memory allocated for variable length datatype

All,

Below given are two instances of allocating memory for variable length
data types

One for unsigned int

data.ref.p = (unsigned int*)malloc(5*(sizeof(unsigned int)));

One for dataset region references

Data.pref.p=(hdset_reg_ref_t*)malloc(10*sizeof(hdset_reg_ref_t));

In both these cases , how should the memory be freed .i.e. should I
explicitly call free ? Or use the H5Dvlen_reclaim or is it taken care by
hdf5 internally.

Regards

Ramakrishnan

Hi Ramakrishnan,

···

On Jul 28, 2008, at 7:40 AM, Ramakrishnan Iyer wrote:

All,

Below given are two instances of allocating memory for variable length data types

One for unsigned int

data.ref.p = (unsigned int*)malloc(5*(sizeof(unsigned int)));

One for dataset region references

Data.pref.p=(hdset_reg_ref_t*)malloc(10*sizeof(hdset_reg_ref_t));

In both these cases , how should the memory be freed .i.e. should I explicitly call free ? Or use the H5Dvlen_reclaim or is it taken care by hdf5 internally.

  For these simple variable length sequences, you could certainly just call free, as H5Dvlen_reclaim() might be a bit of an overkill. The HDF5 library doesn't free memory in raw data arrays that are received from or returned to applications.

  Quincey

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.