[geos-devel] xie work
strk
strk at keybit.net
Tue Oct 7 15:30:47 EDT 2003
Hello people,
I've committed a few patches extracted from xie work.
Sorry about scrambled commit log - I meant to abort but I couldn't.
Anyway, news are that some functions will work by value instead
of by reference.
LineString::LineString(CoordinateList *,...) will copy given
CoordinateList argument to private space.
This mean that code like test6.cpp (posted
by dave) will leak memory unless the CoordinateList used to
initialize a geometry is explicitly deleted.
LineString::getCoordinates() will return return a copy of
private CoordinateList (as all other subclass corrispondent
functions do).
This mean that callers of getCoordinates() should delete result
when done.
GeometryCollection::getCoordinate() is one of these callers,
modified to delete childCoordinates. PointLocator::locate()
is another one fixed. GeometryGraph::addPolygonRing() is another
one.
CoordinateList::removeRepeatedPoints(CoordinateList *)
will now return a copy of given object with consecutive equal
points removed. This means that all callers can safely delete
returned value.
I did commit these changes because the more I test the more
code I might change due to the nature of these modification,
and I did not want to find myself patching an obsolete geos ;)
We should be syncronized about this.
I think that being more memory consumptive but less error prone
will help geos get to a release. It is clear to me that most of
geos bugs are related to memory management issues that might not
have been a problem in a garbage collecting environment like JAVA.
I would start writing some comments before every patched
public method to document its behaviour in respect to memory
management. How is this done to have doxygen understand it ?
Please note that committed patches will probably result in more
cascading leaks detected, but the leaks should now be more easly
removed.
--strk;
More information about the geos-devel
mailing list