JuliaLang / AllocCheck.jl

AllocCheck
Other
209 stars 8 forks source link

Add `@check_allocs` macro to enforce allocation checks #34

Closed topolarity closed 8 months ago

topolarity commented 8 months ago

This allows a user to enforce that a function will not be called with any set of arguments that would trigger unbounded allocation in its body:

@check_allocs energy(x) = sum(abs2.(x))

@check_allocs function pythag(a, b, c)
    return a^2 + b^2 + c^2
end

const inplace_sum = @check_allocs (x, y) -> x .= x .+ y

TODO:

Resolves #30