We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c516d6 commit 8ca05c9Copy full SHA for 8ca05c9
src/GC/GC.jl
@@ -96,6 +96,16 @@ function enqueue_all(ptrs)
96
nothing
97
end
98
99
+"""
100
+ GCHook()
101
+
102
+An immortal object which frees any pending Python objects when Julia's GC runs.
103
104
+This works by creating it but not holding any strong reference to it, so it is eligible
105
+to be finalized by Julia's GC. The finalizer empties the PythonCall GC queue if
106
+possible. The finalizer also re-attaches itself, so the object does not actually get
107
+collected and so the finalizer will run again at next GC.
108
109
mutable struct GCHook
110
function GCHook()
111
finalizer(_gchook_finalizer, new())
0 commit comments