julia> using AllocCheck
julia> function alloc_in_catch(x)
try
Base.inferencebarrier(nothing) # Prevent catch from being elided
catch
return Any[] # in catch block: filtered by `ignore_throw=true`
end
return Int64[]
end
alloc_in_catch (generic function with 1 method)
julia> length(check_allocs(alloc_in_catch, (); ignore_throw=false))
ERROR: MethodError: no method matching alloc_in_catch()
<snip> ...
julia> function alloc_in_catch()
return Int64[]
end
alloc_in_catch (generic function with 2 methods)
julia> length(check_allocs(alloc_in_catch, (); ignore_throw=false))
ERROR: MethodError: no method matching alloc_in_catch()
The applicable method may be too new: running in world age 25448, while current world is 25449.
<snip> ...
The first MethodError is expected, but the second one is a surprise.
The first MethodError is expected, but the second one is a surprise.