On 2016-03-14 14:58-0700 Alan W. Irwin wrote: > I am going to follow up by trying some valgrind runs on Linux for > example 19 without shapelib and for both Tcl and C to see if valgrind > can spot the fundamental memory management issue that is causing the > segfault for your particular (Cygwin) combination of circumstances.
Hi Arjen: In fact, for the -DHAVE_SHAPELIB:BOOL=OFF case where example 19 complains about shapelib being missing, if you build the test_c_psc and test_tcl_psc targets on Linux (to build all required prerequisites) and then run cd examples/tcl env PATH=../../bindings/tcl:$PATH valgrind --num-callers=40 --trace-children=yes ./x19 -dev psc -o testt.psc there are no memory management issues (0 errors) and some minor memory leak issues. Furthermore, valgrind --num-callers=40 ../c/x19c -dev psc -o testc.psc gives perfect valgrind results (0 errors, no leaks are possible) for the C case, and the Tcl and C example PostScript results are identical for this example. So valgrind finds nothing seriously wrong with example 19 for -DHAVE_SHAPELIB:BOOL=OFF for the Tcl and C cases on Linux. However, I followed up further by mimicking what x19 does by hand. That is, I ran the following: ../../bindings/tcl/pltcl -dev psc -o testt.psc source x19.tcl plinit x19 plend And after a lot of complaints about shapelib being missing I ran into the following peculiar matrix operator message: [...] *** PLPLOT WARNING *** plmaptex is a no-op because shapelib is not available. No matrix operator named "62" So from that last line I am pretty sure that the "62" in $w cmd plmaptex {} "ss/ss64ne_General_Text" 1.0 0.0 0.5 "Caffyns\nHeanton\nDown" $minx $maxx $miny $maxy 62 in examples/tcl/x19.tcl is the cause of the above matrix operator warning on Linux. That warning message comes from line 382 of bindings/tcl/tclMatrix.c. I notice that for all other error conditions that are handled with Tcl_AppendResult, the returned value is TCL_ERROR, but in this particular case the returned value is NULL. Is that difference in pattern significant? In other words, if you changed that NULL to TCL_ERROR would that solve the segfault on Cygwin? In other words do we have two bugs here; one where some misuse of matrix is causing the No matrix operator named "62" warning message, and then a second bug in the way that issue is handled? Anyhow, I hope these speculations lead you to a definitive fix for both bugs if it turns out you agree with me that there are actually two bugs to deal with here, the NULL return value that likely should be changed to TCL_ERROR to get rid of the segfault on Cygwin, and also the actual condition that causes the above matrix operator message to be emitted. 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); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); 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 __________________________ ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140 _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel