Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

take ownership of triangulation memory - OOM errors #211

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

JonasIsensee
Copy link
Contributor

Currently, I observe the following steady increase in memory upon repeated triangulations
eventually leading to OOM errors:

julia> using GeometryBasics

julia> points = Point2f.(reverse.(sincos.(0:0.01:2π)));

julia> triang = GeometryBasics.earcut_triangulate([points]);

julia> Sys.maxrss()/2^20
433.01171875

julia> @time for i=1:10^5
         GeometryBasics.earcut_triangulate([points]);
       end
 19.742204 seconds (500.00 k allocations: 30.518 MiB, 0.06% gc time)

julia> GC.gc(true)

julia> Sys.maxrss()/2^20
1156.88671875

julia> @time for i=1:10^5
         GeometryBasics.earcut_triangulate([points]);
       end
 19.175300 seconds (500.00 k allocations: 30.518 MiB)

julia> GC.gc(true)

julia> Sys.maxrss()/2^20
1873.0859375

With this PR:

julia> points = Point2f.(reverse.(sincos.(0:0.01:2π)));

julia> triang = GeometryBasics.earcut_triangulate([points]);

julia> Sys.maxrss()/2^20
411.16796875

julia> @time for i=1:10^5
         GeometryBasics.earcut_triangulate([points]);
       end
 21.869706 seconds (500.00 k allocations: 748.062 MiB, 1.02% gc time)

julia> GC.gc(true)

julia> Sys.maxrss()/2^20
438.33203125

julia> @time for i=1:10^5
         GeometryBasics.earcut_triangulate([points]);
       end
 21.142299 seconds (500.00 k allocations: 748.062 MiB, 0.17% gc time)

julia> GC.gc(true)

julia> Sys.maxrss()/2^20
438.33203125

@SimonDanisch SimonDanisch merged commit 12266b2 into JuliaGeometry:master Jan 25, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants