Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
From: Alan W. Irwin <irwin@be...> - 2005-01-17 00:55:36
From some valgrind tests I was doing I get the following message about
unfreed memory when using -drvopt text
==21336== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 29 from 1)
==21336== malloc/free: in use at exit: 7 bytes in 2 blocks.
I was worried there was a memory leak in the code to process unicode fonts,
but it turns out to be an unfreed memory issue with the code to parse the
command line options. If you use the --leak-check=yes --show-reachable=yes
options, you get the following additional information:
==21339== 7 bytes in 2 blocks are still reachable in loss record 1 of 1
==21339== at 0x1B906EDD: malloc (vg_replace_malloc.c:131)
==21339== by 0x1B9255ED: plstrdup (plctrl.c:1791)
==21339== by 0x1B914266: opt_drvopt (plargs.c:1756)
==21339== by 0x1B913261: ProcessOpt (plargs.c:985)
==21339== by 0x1B912F25: plParseOpts (plargs.c:822)
==21339== by 0x80486DD: main (in /tmp/examples/c/x10c)
==21339== LEAK SUMMARY:
==21339== definitely lost: 0 bytes in 0 blocks.
==21339== possibly lost: 0 bytes in 0 blocks.
==21339== still reachable: 7 bytes in 2 blocks.
==21339== suppressed: 0 bytes in 0 blocks.
The plargs code says (slightly earlier in the code where other mallocs
occur) don't release the memory that is malloced there because of familying
concerns. I don't understand familying well enough to know if that comment
is still true, but if it is, the solution is probably to release the memory
only when the library is closed during the plend command.
Andrew (Ross), would you be willing to take a look at this? It's not worth a
lot of trouble, but OTOH it's nice to have results which are normally
valgrind clean so that when you do get a valgrind message about some bytes
still in use at exit after a code change it means something.
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 Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project