Hi Torquil, I found the problem. Some months ago changes were made, how the plot commands were recorded (into the memory instead of a file) to be able to replot them. If the plot stream is copied with plcpstrm() also the pointer to this memory is copied (not the memory itself). if you end the copied stream this buffer gets freed. if the first stream is ended, the buffer gets freed the second time->segfault. I didn't write this memory buffer changes, so I don't know if we need the buffer in the new stream, but if it needs to be copied, I suggest that new memory is allocated and the whole memory is copied instead (I also post this to the devel list). Any objections?
Regards, Werner PS: Thanks Torquil for finding this bug. Torquil Macdonald Sørensen wrote: > Hello, just disregard this if it is the same as the other thread with a > segfault and if it does not provide any more information. > > I get a segfault I get when running the C-example no.1 with the "-save" > option: > > x01c -dev xwin -np -save 1.psc > > If I comment out plend() in the example, it works fine. I'm using todays SVN > version, built with debugging symbols. The examples are also built with > debugging, but gdb gives me no output more than: > > Program received signal SIGSEGV, Segmentation fault. > 0xb7cdd33c in free () from /lib/i686/cmov/libc.so.6 > > Valgrind gives lots of output, but it is the last one that seems most > interesting: > > ==32061== Invalid free() / delete / delete[] > ==32061== at 0x402465C: free (vg_replace_malloc.c:323) > ==32061== by 0x40417EF: c_plend1 (plcore.c:1823) > ==32061== by 0x40411FB: c_plend (plcore.c:1759) > ==32061== by 0x804904D: main (x01c.c:210) > ==32061== Address 0x430d4f8 is 0 bytes inside a block of size 131,072 free'd > ==32061== at 0x402465C: free (vg_replace_malloc.c:323) > ==32061== by 0x40417EF: c_plend1 (plcore.c:1823) > ==32061== by 0x8048F3B: main (x01c.c:184) > > There seems to be some problem with freeing memory. It looks like the error > message in sec.4.3.4 in the valgrind manual, here: > > http://valgrind.org/docs/manual/mc-manual.html#mc-manual.errormsgs > >>From what I can understand (which may be wrong) it is related to freeing the > memory for plsc->plbuf_buffer, but after looking through the code I think it > will be too complicated for me to track down the error. > > Best regards, > Torquil Sørensen > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Plplot-general mailing list > Plplot-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/plplot-general -- Dr. Werner Smekal Institut fuer Allgemeine Physik Technische Universitaet Wien Wiedner Hauptstr 8-10 A-1040 Wien Austria email: [EMAIL PROTECTED] web: http://www.iap.tuwien.ac.at/~smekal phone: +43-(0)1-58801-13463 (office) +43-(0)1-58801-13469 (laboratory) fax: +43-(0)1-58801-13499 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Plplot-general mailing list Plplot-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-general