Memory leak when using unary_union
See original GitHub issueWhen using unary_union it seems that some memory leaks occur.
For example when running the above code the virtual memory used by the python process increase continuously.
from shapely.geometry import Polygon, LineString
from shapely.ops import unary_union
a = Polygon([(0, 0), (0, 1), (1, 1), (1, 0)])
b = LineString([(0, 0), (1, 1)])
for _ in range(1000000):
c = unary_union((a, b))
I am facing the issue on a CentOS 7 machine, with Python3, Shapely 1.6.4.post2 (from pip) and Proj 4.8.0.
EDIT: the same append with cascaded_union
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Memory leak when using unary_union · Issue #745 - GitHub
When using unary_union it seems that some memory leaks occur. For example when running the above code the virtual memory used by the...
Read more >Why does this union structure cause a memory leak?
Using valgrind I have determined that this data structure, as is, has a memory leak. The way to verify that this structure is...
Read more >#830 (Possible memory leak in WKTReader with partial ...
Am I doing something wrong with the API or is this a bug with WKTReader not cleaning up in the case of an...
Read more >QisBool Core Functions - Artwork Conversion Software
To perform Boolean operations (single threaded) such as Unary Union, ... to free this memory by calling QisBool_Release, otherwise a memory leak will...
Read more >Changelog for GEOS 3.9.0 - ABI laboratory
... Sergey Fedoseev) - Fix crash in GEOSUnaryUnion with empty LineString (#928, Sergey Fedoseev) - Fix memory leak in SIRtree::insert (#919, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Confirmed. I ran the code under valgrind with 100 loops and I see
Meanwhile, the work around is to use union in such a loop, or call unary_union once with a list of all source geometries, which is its intended use.