Can calling finalize lead to a double free?

nhz2
Thu, 04 Jul 2024 03:35:50 +0000
General Usage

Are finalizers guaranteed to only run at most one time? Is there any way for a finalizer to somehow get called twice, for example, if finalize is called in multiple other finalizers, or manually called in different threads?

I am trying to manually free memory not owned by Julia when I know it won’t be used later, but also have a finalizer as a fallback to avoid memory leaks.

5 posts - 4 participants