Paul, FYI: I've pushed some fixes to that branch. Keep this in mind
before you change your local copy too much. It's just some override
keywords and a fix to autotools scripts at time of writing.

The code, in its current form, passes `make check` (not sure how much
of the new code `make check` actually tests, but I saw some unit test).

--strk;

On Fri, Jul 24, 2020 at 12:07:44PM +0200, Sandro Santilli wrote:
> On Thu, Jul 23, 2020 at 08:22:44PM -0700, Paul Ramsey wrote:
> > I'm trying to clean up memory use in the new overlayng code, on the 
> > overlay-sr branch, and have come to an impasse. 
> > 
> > The valgrind report is here: 
> > https://gist.github.com/pramsey/d4be398473ea49ff4e241f5e7d4b855b
> 
> That report contains multiple leaks, which are reported from smaller
> to bigger, so I'd start at the end of it:
> 
> ==6519== 59,784,992 (40,104 direct, 59,744,888 indirect) bytes in 1,671 
> blocks are definitely lost in loss record 8,846 of 8,847
> ==6519==    at 0x4C29203: operator new(unsigned long) 
> (vg_replace_malloc.c:334)
> ==6519==    by 0x528EBAA: 
> geos::noding::NodedSegmentString::getNodedSubstrings(std::vector<geos::noding::SegmentString*,
>  std::allocator<geos::noding::SegmentString*> > const&) 
> (NodedSegmentString.cpp:148)
> 
> The ownership of those SegmentStrings is not documented in
> NodedSegmentString.h, which would help. My impression is that
> those segment strings should be shared pointers, to overcome this
> long standing issue (it was a problem before snaprounding as well).
> 
> I think the caller should take ownership of those objects.
> In this case, the caller is ValidatingNoder, which is storing
> those into its 'nodedSS' member, which is an heap-allocated
> vector. That vector is returned by
> ValidatingNoder::getNodedSubstrings() which is also undocumented
> but is probably expected to pass ownership back to its own caller.
> 
> I suggest you destroy the vector and its contents IFF
> getNodedSubstring is never called, which may be the case here.
> 
> Or (bigger change) use shared pointers.
> 
> PS: I like the DEVELOPER-NOTES.md file
> 
> --strk;
> _______________________________________________
> geos-devel mailing list
> geos-devel@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geos-devel
_______________________________________________
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Reply via email to