diff --git a/src/AllocCheck.jl b/src/AllocCheck.jl index 3c3a147..ebadab7 100644 --- a/src/AllocCheck.jl +++ b/src/AllocCheck.jl @@ -254,7 +254,7 @@ AllocCheck.AllocInstance[] ``` """ -function check_allocs(@nospecialize(func), @nospecialize(types); entry_abi=:specfunc, ret_mod=false, ignore_throw=false) +function check_allocs(@nospecialize(func), @nospecialize(types); entry_abi=:specfunc, ret_mod=false, ignore_throw=true) job = create_job(func, types; entry_abi) allocs = AllocInstance[] mod = JuliaContext() do ctx diff --git a/test/runtests.jl b/test/runtests.jl index 9bf383a..3bfde51 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,18 +17,18 @@ function same_ccall() end @testset "AllocCheck.jl" begin - @test length(check_allocs(mod, (Float64,Float64))) == 0 + @test length(check_allocs(mod, (Float64,Float64); ignore_throw=false)) == 0 @test length(check_allocs(sin, (Float64,); ignore_throw=false)) > 0 @test length(check_allocs(sin, (Float64,); ignore_throw=true)) == 0 - @test length(check_allocs(*, (Matrix{Float64},Matrix{Float64}))) != 0 + @test length(check_allocs(*, (Matrix{Float64},Matrix{Float64}); ignore_throw=true)) != 0 @test length(check_allocs(alloc_in_catch, (); ignore_throw=false)) == 2 @test length(check_allocs(alloc_in_catch, (); ignore_throw=true)) == 1 - @test length(check_allocs(same_ccall, (), ignore_throw=false)) == 2 - @test length(check_allocs(same_ccall, (), ignore_throw=true)) == 2 + @test length(check_allocs(same_ccall, (); ignore_throw=false)) == 2 + @test length(check_allocs(same_ccall, (); ignore_throw=true)) == 2 - @test length(check_allocs(first, (Core.SimpleVector,); ignore_throw = false)) == 3 - @test length(check_allocs(first, (Core.SimpleVector,); ignore_throw = true)) == 0 - @test length(check_allocs(time, ())) == 0 + @test length(check_allocs(first, (Core.SimpleVector,); ignore_throw=false)) == 3 + @test length(check_allocs(first, (Core.SimpleVector,); ignore_throw=true)) == 0 + @test length(check_allocs(time, (); ignore_throw=false)) == 0 end