georust / georust/proj

Should proj_cleanup be run if there are active contexts?

Open
#75 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Rust
Stars
186
Forks
63
PR merge metrics
No merged PRs in 30d

Description

> This function frees global resources (grids, cache of +init files). It should be called typically before process termination, and after having freed PJ and PJ_CONTEXT objects.
>
> - https://proj.org/development/reference/functions.html#c.proj_cleanup

This crate runs `proj_cleanup` on every [`Drop` for `Proj` and `ProjBuilder`](https://github.com/georust/proj/blob/81b233a54f2da49b5e5a5ae1aee855910df838ec/src/proj.rs#L885-L907). So if you have two `Proj` instances in your application and one gets dropped, we'll run `proj_cleanup` even though the other `Proj` is still alive. My interpretation of the documentation for `proj_cleanup` (above) is that we should only run `proj_cleanup` after _all_ other PROJ objects and contexts have been freed.

If this is the case, we'd need to think through how to accomplish this, as Rust has no way to automatically run code when a process ends. We'd have to do some sort of reference counting and only run `proj_cleanup` if we know there are now `Proj` instances alive

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.