[geos-devel] Request for change
strk at refractions.net
strk at refractions.net
Wed Mar 1 05:16:43 EST 2006
Would 'static const string errMsg[]' have the same effect ?
--strk;
On Wed, Mar 01, 2006 at 10:27:53AM +0100, Stefan Zschocke wrote:
> 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