-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathGC.jl
27 lines (26 loc) · 906 Bytes
/
GC.jl
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)
Threads.@threads for obj in pyobjs
finalize(obj)
end
end
# The GC sometimes actually frees everything before this line.
# We can uncomment this line if we GIL.@release the above block once we have it.
# Threads.nthreads() > 1 && @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)
Threads.@threads for obj in pyobjs
finalize(obj)
end
end
# The GC sometimes actually frees everything before this line.
# We can uncomment this line if we GIL.@release the above block once we have it.
# Threads.nthreads() > 1 && @test !isempty(PythonCall.GC.QUEUE.items)
GC.gc()
@test isempty(PythonCall.GC.QUEUE.items)
end