[geos-devel] [GEOS] #923: Memory leak in GEOSNode

GEOS geos-trac at osgeo.org
Tue Sep 18 15:18:05 PDT 2018

#923: Memory leak in GEOSNode
 Reporter:  Algunenano   |       Owner:  geos-devel@…
     Type:  defect       |      Status:  new
 Priority:  major        |   Milestone:  3.7.0
Component:  Default      |     Version:  master
 Severity:  Significant  |  Resolution:
 Keywords:               |

Comment (by cvvergara):

 So, I am testing on the commit that merged to master: building with gcc

 `git checkout -b test-try2 8a9600bb2e617c788fdcdad8eb9e9045925bbd23`

 cleaned the build, and testing this
 $ clang -fsanitize=address geos_leak.c -lgeos_c
 -L/home/vicky/geos/vicky/build/lib -I/home/vicky/geos/vicky/build/include
 -I /home/vicky/geos/vicky/include
 geos_leak.c:1:10: fatal error:
 '/home/vicky/geos/vicky/build/capi/geos_c.h' file not found
 #include "/home/vicky/geos/vicky/build/capi/geos_c.h"
 1 error generated.

 As you can see I adjusted to what is being build.

 Building again.

 Here, the missing file has being created, but not the libraries (they are
 on the process of building)

 clang -fsanitize=address geos_leak.c -lgeos_c
 -L/home/vicky/geos/vicky/build/lib -I/home/vicky/geos/vicky/build/include
 -I /home/vicky/geos/vicky/include
 /usr/bin/ld: cannot find -lgeos_c
 clang: error: linker command failed with exit code 1 (use -v to see

 So far so good (I think)

 $clang -fsanitize=address geos_leak.c -lgeos_c
 -L/home/vicky/geos/vicky/build/lib -I/home/vicky/geos/vicky/build/include
 -I /home/vicky/geos/vicky/include
 $ ./a.out

 this didnt reproduce the problem

 Now I am doing with valgrind:
 $ gcc  geos_leak.c -lgeos_c -L/home/vicky/geos/vicky/build/lib
 -I/home/vicky/geos/vicky/build/include -I /home/vicky/geos/vicky/include
 $ valgrind --leak-check=yes ./a.out
 ==761== Memcheck, a memory error detector
 ==761== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
 ==761== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
 ==761== Command: ./a.out
 ==761== HEAP SUMMARY:
 ==761==     in use at exit: 73,848 bytes in 4 blocks
 ==761==   total heap usage: 65 allocs, 61 frees, 81,840 bytes allocated
 ==761== LEAK SUMMARY:
 ==761==    definitely lost: 0 bytes in 0 blocks
 ==761==    indirectly lost: 0 bytes in 0 blocks
 ==761==      possibly lost: 0 bytes in 0 blocks
 ==761==    still reachable: 73,848 bytes in 4 blocks
 ==761==         suppressed: 0 bytes in 0 blocks
 ==761== Reachable blocks (those to which a pointer was found) are not
 ==761== To see them, rerun with: --leak-check=full --show-leak-kinds=all
 ==761== For counts of detected and suppressed errors, rerun with: -v
 ==761== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Ticket URL: <https://trac.osgeo.org/geos/ticket/923#comment:5>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).

More information about the geos-devel mailing list