From: Alan W. I. <ir...@be...> - 2007-04-11 03:30:38
|
On 2007-04-09 09:10-0700 winson wrote: > I used the newly compiled library in my code. Similar > error, but a little bit different info. > > Error: > HEAP CORRUPTION DETECTED: after Normal block (#18524) > at 0x01809958. CRT detected that the application wrote > to memory after end of heap buffer. > > Threads: > wxGridBagSizer::FindItemAtPosition opt_drvopt Normal 0 > > Call Stack: > msvcr80d.dll!1021bd53() > plplotd.dll!opt_drvopt(char * opt=0x0105c209, char * > optarg=0x018098d9, void * client_data=0x00000000) > Line 1771 + 0x22 bytes C > > I tracked it down, the problem is in wxPLplotstream > constructor, on line: > SetOpt( "-drvopt", drvopt ); > > And further, in file plargs.c, on line > free(option); free(value); > near the end of opt_drvopt(char *opt, char *optarg, > void *client_data) > > I am not sure what the problem exactly is. But as my > code was just trying to get an instance of > wxPLplotstream, it is likely a memory problem in the > compiled library, perhaps related to wxWidgets(?). Hi Winson: I just built wxPLplotDemo.cpp, the one standard example we have (in examples/c++) that uses libplplotwxwidgetsd. On Linux, there are no obvious run-time issues with that example, and it produces a good-looking plot. Valgrind reports many memory-management issues which could _potentially_ cause heap corruption with this example, but I don't know whether that is simply false positive valgrind noise from the Linux library stack or a real problem with builtwxPLplotDemo.cpp or the code compiled for libplplotwxwidgetsd, but none of the valgrind messages involve wxPLplotstream::wxPLplotstream (where you found problems with SetOpt( "-drvopt", drvopt ); on your platform.) Do you want to try building wxPLplotDemo.cpp to see whether it generates any heap corruption on your platform? Note its entirely possible you could have heap corruption on your platform for this example due to some problems in conditionally compiled code (see #ifdef WX_TEMP_HAVE_FREETYPE_IS_ON and #ifdef WX_TEMP_HAVE_AGG_IS_ON just above where you crapped out) that you compile and I don't on Linux or vice versa. OTOH, you may also not generate heap corruption on your system with wxPLplotDemo which would say something about your own example. Anyhow, a direct comparison of the results for the same wxPLplotDemo example on our two platforms should help to guide us to the exact source of the problem. 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 Yorick front-end to PLplot (yplot.sf.net); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |