[geos-devel] Request for Eyeballs

Martin Davis mtnclimb at gmail.com
Sat Jul 25 16:51:56 PDT 2020


On Sat, Jul 25, 2020 at 9:41 AM Sandro Santilli <strk at kbt.io> wrote:

> 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.
>

Definitely. Using C++ language constructs, if possible.

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.
>

Well, yes.  The new noders (SnapRouningNoder and SnappingNoder) are not
recursive, so don't have this problem.  The goal I think is to eliminate
other kinds of noding, since they should be superseded.  But I realize that
might have to be a long-term goal.

Anyway, if there are noders with that behaviour, don't they already handle
their own memory?  Or are there leaks in old code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20200725/a335e7cb/attachment.html>


More information about the geos-devel mailing list