#342 closed defect (fixed)
Prepared MultiPolygon predicates leak memory
Reported by: | olt | Owned by: | sgillies |
---|---|---|---|
Priority: | minor | Milestone: | 3.3.0 |
Component: | Default | Version: | main |
Severity: | Annoyance | Keywords: | memory leak, prepared geometries, multipolygon |
Cc: | olt@… |
Description
Using prepared binary predicates like 'contains' with MultiPolygons leaks memory. I have tested it with 3.1.1, 3.2.0 (using Shapely, which uses the C API) and latest trunk (r2982) with the attached C test program. So it might be a C API only bug.
The test program does not leak if the predicate is called directly with the MultiPolygon (no prepared geometry) or if the prepared geometry is only a polygon.
Attachments (1)
Change History (9)
by , 14 years ago
Attachment: | memleak_mp_prep.c added |
---|
comment:1 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 14 years ago
Priority: | major → minor |
---|---|
Severity: | Unassigned → Annoyance |
Leaks and valgrind both say no leaks, but the footprint of the prepared geometry does grow. Looks like it's accumulating data as contains() is called.
comment:3 by , 13 years ago
3.2.2 fixed context leaks can you still see the leak with that version ?
comment:4 by , 13 years ago
No. Just recompiled the test program and it still leaks memory.
% gcc memleak_mp_prep.c -o memleak_mp_prep -L../tmp/geos-3.2.2/capi/.libs/ -lgeos_c % DYLD_LIBRARY_PATH=../tmp/geos-3.2.2/capi/.libs:../tmp/geos-3.2.2/source/.libs ./memleak_mp_prep
comment:5 by , 13 years ago
Ok. I did some testing with a profiler and there are a lot of malloc calls from MCIndexSegmentSetMutualIntersector. Further testing shows that chainStore is growing infinite.
comment:6 by , 13 years ago
I can confirm the analisys. Will look for a possible workaround. We have no garbage collector so must find out when it is safe to cleanup.
comment:7 by , 13 years ago
Milestone: | → 3.3.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Fixed in r3357. Thanks for not letting this issue fade away.
comment:8 by , 13 years ago
Great. I tested it with trunk again and it looks like it was the only leak, since memory is now constant.
Test program to demonstrate memory leak