JuliaLang / AllocCheck.jl

AllocCheck
Other
209 stars 8 forks source link

Add documentation to clarify that calling an allocation-free function can still allocate #31

Closed topolarity closed 8 months ago

topolarity commented 8 months ago

Although e.g. check_allocs(foo, (Ref{Int64},)) may report no allocations, it is still possible for a call to it to require an allocation (or indeed for every possible call to it to require an allocation for ABI reasons). To make the problem worse, once solution (1) from https://github.com/JuliaComputing/AllocCheck.jl/issues/30 is implemented, there will be a significant dynamic dispatch overhead + allocation to every AllocCheck.jl function call on Julia <= 1.9

Based on discussions with @baggepinnen, this shouldn't be a showstopper since a bounded amount of one-time allocation on function entry is acceptable if users are careful about how they structure their application code.

However, it's still very counter-intuitive so it's probably worth having some targeted explanation in the docs.