From: Alan W. I. <ir...@be...> - 2011-02-04 22:30:39
|
On 2011-02-04 22:42+0200 Dmitri Gribenko wrote: > Hi Alan, (off-list) > > On Fri, Feb 4, 2011 at 9:27 PM, Alan W. Irwin <ir...@be...> wrote: >> for ( k = 0; k < MAX_NLEGEND; k++ ) >> delete text[k]; > > delete [] text; Hi Dimitri: I am taking this back to the list because your suggestion lead to the solution. I think you meant delete [] text[k]; in the above loop since obviously there has to be a delete for each of the MAX_NLEGEND new strings. Anyhow, valgrind is completely happy with that change so thanks for this suggestion that lead to the solution (revision 11546). Anyone care to have a go at explaining the difference in meaning between delete text[k]; and delete [] text[k]; ? Both compile, run, and produce good results; but the former annoys valgrind (and may actually do bad things) while the latter does not. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |