Hi Andrew:
I get the following valgrind result with C++ example 33:
==9193== Mismatched free() / delete / delete []
==9193== at 0x4C23E0F: operator delete(void*)
(vg_replace_malloc.c:387)
==9193== by 0x406A70: x33::x33(int, char const**) (x33.cc:823)
==9193== by 0x406AF4: main (x33.cc:830)
==9193== Address 0x6ef3b90 is 0 bytes inside a block of size 200
alloc'd
==9193== at 0x4C24A72: operator new[](unsigned long)
(vg_replace_malloc.c:305)
==9193== by 0x403F26: x33::x33(int, char const**) (x33.cc:278)
==9193== by 0x406AF4: main (x33.cc:830)
>From these messages it appears something is wrong with the
allocation/deallocation of the text character string used for
pllegend. The relevant code is
char *text[MAX_NLEGEND];
for ( k = 0; k < MAX_NLEGEND; k++ )
text[k] = new char[200];
for ( k = 0; k < MAX_NLEGEND; k++ )
delete text[k];
That seems OK to me, but I don't have much C++ experience. Is there
something obviously wrong with the above code? If it is okay, but
valgrind is being over-sensitive, is there a way we can quieten
valgrind?
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
__________________________
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel