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

Should proj_cleanup be run if there are active contexts? #75

Open
frewsxcv opened this issue Feb 14, 2021 · 0 comments
Open

Should proj_cleanup be run if there are active contexts? #75

frewsxcv opened this issue Feb 14, 2021 · 0 comments
Labels

Comments

@frewsxcv
Copy link
Member

frewsxcv commented Feb 14, 2021

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.

This crate runs proj_cleanup on every Drop for Proj and ProjBuilder. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant