-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathGC.jl
More file actions
32 lines (30 loc) · 876 Bytes
/
GC.jl
File metadata and controls
32 lines (30 loc) · 876 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
28
29
30
31
32
@testset "201: GC segfaults" begin
# https://github.com/JuliaPy/PythonCall.jl/issues/201
# This should not segfault!
cmd = Base.julia_cmd()
path = joinpath(@__DIR__, "finalize_test_script.jl")
p = run(`$cmd -t2 --project $path`)
@test p.exitcode == 0
end
@testset "GC.gc()" begin
let
pyobjs = map(pylist, 1:100)
Threads.@threads for obj in pyobjs
finalize(obj)
end
end
Threads.nthreads() > 1 && @test !isempty(PythonCall.GC.QUEUE.items)
PythonCall.GC.gc()
@test isempty(PythonCall.GC.QUEUE.items)
end
@testset "GC.GCHook" begin
let
pyobjs = map(pylist, 1:100)
Threads.@threads for obj in pyobjs
finalize(obj)
end
end
Threads.nthreads() > 1 && @test !isempty(PythonCall.GC.QUEUE.items)
GC.gc()
@test isempty(PythonCall.GC.QUEUE.items)
end