forked from JuliaPy/PythonCall.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGC.jl
More file actions
27 lines (26 loc) · 726 Bytes
/
GC.jl
File metadata and controls
27 lines (26 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@testitem "GC.gc()" begin
let
pyobjs = map(pylist, 1:100)
PythonCall.GIL.@unlock Threads.@threads for obj in pyobjs
finalize(obj)
end
end
Threads.nthreads() > 1 &&
VERSION >= v"1.10.0-" &&
@test !isempty(PythonCall.GC.QUEUE.items)
PythonCall.GC.gc()
@test isempty(PythonCall.GC.QUEUE.items)
end
@testitem "GC.GCHook" begin
let
pyobjs = map(pylist, 1:100)
PythonCall.GIL.@unlock Threads.@threads for obj in pyobjs
finalize(obj)
end
end
Threads.nthreads() > 1 &&
VERSION >= v"1.10.0-" &&
@test !isempty(PythonCall.GC.QUEUE.items)
GC.gc()
@test isempty(PythonCall.GC.QUEUE.items)
end