Skip to content

Commit

Permalink
Merge pull request #49 from JuliaLang/ct/add-warning
Browse files Browse the repository at this point in the history
Add warning to `check_allocs(...)`
  • Loading branch information
topolarity authored Nov 20, 2023
2 parents 03c3a48 + 875e3ba commit 48a8c34
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/AllocCheck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,18 @@ end
check_allocs(func, types; ignore_throw=true)
Compiles the given function and types to LLVM IR and checks for allocations.
Returns a vector of `AllocationSite` structs, each containing a `CallInst` and a backtrace.
Returns a vector of `AllocationSite`, `DynamicDispatch`, and `AllocatingRuntimeCall`
!!! warning
The Julia language/compiler does not guarantee that this result is stable across
Julia invocations.
If you rely on allocation-free code for safety/correctness, it is not sufficient
to verify `check_allocs` in test code and expect that the corresponding call in
production will not allocate at runtime.
For this case, you must use `@check_allocs` instead.
# Example
```jldoctest
Expand Down

0 comments on commit 48a8c34

Please sign in to comment.