- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Finalizers for modules? #8764
Comments
When would this be called? At exit? |
At exit would be for the use cases I was thinking about. I don't know how module reloading would play into this. |
Calling |
calling |
all atexit handlers are called before all finalizers which remain active at program exit. what is your desired order? |
It is a common pattern where objects retaining handles to allocated resources often free their resources when the object is gc'd. I guess the behavior I'm looking for is for the "module finalizer" to run after all other active finalizers have been run. This usually would be some |
Module finalizers (JuliaLang/julia#8764) would be a better option here.
I have had a couple of instances where this feature would be nice to have in terms of dealing with global state when interfacing with some external c-library. Thinking through some of the implications of #8745, it seems like it would be necessary to support pre-compiling packages in many instances (at least for some I have written).
The text was updated successfully, but these errors were encountered: