[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 970923: netcdf memory leak and 3.3.1 sync()



>To: address@hidden
>From: address@hidden (Gordon Maclean)
>Subject: netcdf memory leak and 3.3.1 sync()
>Organization: .
>Keywords: 199709231637.KAA17081

Hi Gordon,

> This is a rambling report of some memory leaks, and issues connected with
> syncing files.
> 
> 
> In
>       NcVar* NcFile::add_var(NcToken, NcType, int , const NcDim**)
>       
> you need to delete[] dimids before returning.
> 
> This leak exists in the C++ code for version 2.4.3 and 3.3.1. This leak
> has probably been reported, though I didn't see anything about it in
> the support email archive.

Yes, thanks, you're right about the leak.  I've fixed it as you suggest,
and it will be in the next minor release (unless it's too late for that;
Glenn?).

> NcVar::edges() returns a pointer which is not managed (deleted) by
> NcVar.  The documentation says it returns a const pointer. This issue
> needs to be sorted out, who owns the pointer?

The documentation was wrong; the caller needs to delete the returned
array of edge lengths when done with it.  Thanks for pointing out the
inconsistency.  I've fixed the documentation.

--Russ