Opened 7 years ago
Closed 7 years ago
#790 closed defect (fixed)
Memory leak in WKBReader.read?
Reported by: | edzer | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 3.5.1 |
Component: | Default | Version: | 3.5.0 |
Severity: | Unassigned | Keywords: | |
Cc: |
Description
When running the attached program with
valgrind --tool=memcheck --leak-check=full ./mem
it reports a memory leak. I see it pretty consistently with anything read this way with WKBReader.read().
Is this in my c++ code, or in geos?
Attachments (1)
Change History (5)
by , 7 years ago
comment:1 by , 7 years ago
Check test/unit/io/WKBReaderTest.cpp, is your test doing things differently ?
Run with libtool --mode=execute valgrind ./geos_unit geos::io::WKBReader
to ask valgrind about leaks generated there.
comment:2 by , 7 years ago
For the record, the valgrind report here:
==12044== HEAP SUMMARY: ==12044== in use at exit: 72,704 bytes in 1 blocks ==12044== total heap usage: 7,730 allocs, 7,729 frees, 557,680 bytes allocated ==12044== ==12044== LEAK SUMMARY: ==12044== definitely lost: 0 bytes in 0 blocks ==12044== indirectly lost: 0 bytes in 0 blocks ==12044== possibly lost: 0 bytes in 0 blocks ==12044== still reachable: 72,704 bytes in 1 blocks ==12044== suppressed: 0 bytes in 0 blocks ==12044== Rerun with --leak-check=full to see details of leaked memory ==12044== ==12044== For counts of detected and suppressed errors, rerun with: -v ==12044== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
comment:3 by , 7 years ago
I failed to use the auto_ptr:
typedef std::auto_ptr<geos::geom::Geometry> GeomPtr; GeomPtr pt(r.read(sh));
solved my leak. Thanks a lot!
comment:4 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
cpp program that shows memory lead, compiled with g++ mem.cpp -lgeos-3.5.0