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

Finalizers should be cleared within the Destroy() methods #213

Closed
justinfx opened this issue Jul 21, 2019 · 0 comments
Closed

Finalizers should be cleared within the Destroy() methods #213

justinfx opened this issue Jul 21, 2019 · 0 comments

Comments

@justinfx
Copy link
Member

Various types which wrap the C API pointers (MagickWand, DrawinWand, ...) create finalizers to ensure that the C memory is at least freed at some point later when GC runs. Users also can free the memory immediately by calling the Destroy() method on the object. While the call to Destroy is idempotent, we should make sure to clear the finalizer in the Destroy method to reduce the need for the GC to run finalizers that don't do anything.

runtime.SetFinalizer(mw, nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant