Those two flags should be fairly reliable. Functions are marked with the GC flag when they end up calling jl_gc_*; runtime dispatch looks for jl_invoke/_jl_apply_generic instead. It’s possible that those checks aren’t exhaustive (especially on newer Julia versions), but I don’t they’ll give you false-positives.