[geos-devel] Request for change

Stefan Zschocke s.zschocke at infozoom.de
Wed Mar 1 04:27:53 EST 2006


The error messages in TopologyValidationError are currently defined as 
	static string errMsg[];
This causes dynamic memory allocations from std::string ctor. Under certain
circumstances, when the Geos.dll is not unloaded before the heap is checked
for leaks, these are incorrectly dumped as memory leaks by VC++.
When these constants are defined as 
	static const char* errMsg[];
Then this doesn't happen and the heap shows clean. The change requires only
changing the type in declaration and implementation without further
necessity of code changes.
Same situation with WBKReader::BAD_GEOM_TYPE_MSG
If the declaration is changed to const char*, then a few code changes need
to be done: 
Instead of 				
  throw new ParseException(BAD_GEOM_TYPE_MSG+	" Polygon");
Make it
  throw new ParseException(string(BAD_GEOM_TYPE_MSG)+	" Polygon");

It takes a minute or so to do it, and after that the heap shows clean, which
makes it much easer to trace "real" leaks.
Stefan




More information about the geos-devel mailing list