[geos-devel] Request for Eyeballs

Sandro Santilli strk at kbt.io
Sat Jul 25 09:40:53 PDT 2020


On Sat, Jul 25, 2020 at 07:12:08AM -0700, Martin Davis wrote:
> Good observations, Sandro.  My thoughts are below.
> 
> On Fri, Jul 24, 2020 at 8:01 AM Sandro Santilli <strk at kbt.io> wrote:
> 
> >
> > The methods defined for a Noder are:
> >
> >   virtual void computeNodes(std::vector<SegmentString*>* segStrings) = 0;
> >   virtual std::vector<SegmentString*>* getNodedSubstrings() const = 0;
> >
> > What isn't clear is:
> >
> >   - Who owns the SegmentString passed to computeNodes ?
> >   - Who owns the SegmentString returned by getNodedSubstrings ?
> >   - Can the same SegmentString be present in both input and output
> >     containers ?
> >
> 
> - Noders are a process, not a container.  As such, they should not own
> anything.
> -- The caller owns the NodedSegmentStrings passed in to the Noder.
> -- The caller owns the SegmentStrings returned by getNodedSubstrings
> 
> - getNodedSubstrings should always return new SegmentStrings, even if they
> are just a copy of an input SegmentString (i.e. no nodes were found and
> added to the original NodedSegmentString (This will make it easier to
> handle the lifecycle of the inputs and outputs I think?)
> 
> I'm not sure if JTS/GEOS obeys these semantics. In JTS it doesn't matter
> much, but GEOS should be fixed to have this contract.

For sure it should be fixed to DOCUMENT this contract.
I think current (the ones reachable from C-API) do respect it,
which means that some of them have to DESTROY SegmentString objects
that only exist temporary (think recursive noder) because those
objects would never be returned back to caller, thus woule be left
leaking.

--strk;


More information about the geos-devel mailing list