[geos-devel] Request for Eyeballs

Sandro Santilli strk at kbt.io
Fri Jul 24 03:07:44 PDT 2020


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;


More information about the geos-devel mailing list