Skip to content

Add get_pgcstack_static to non-allocating allowlist#100

Open
sunxd3 wants to merge 1 commit into
JuliaLang:mainfrom
sunxd3:fix/get-pgcstack-static
Open

Add get_pgcstack_static to non-allocating allowlist#100
sunxd3 wants to merge 1 commit into
JuliaLang:mainfrom
sunxd3:fix/get-pgcstack-static

Conversation

@sunxd3
Copy link
Copy Markdown

@sunxd3 sunxd3 commented Mar 23, 2026

Summary

  • On arm64 (Apple Silicon), Julia uses jl_get_pgcstack_static instead of jl_get_pgcstack to access the GC stack
  • This variant was missing from the fn_may_allocate allowlist in src/classify.jl, causing spurious "1 allocation" reports for every @check_allocs-decorated function on macOS/arm64
  • Fix: add "get_pgcstack_static" alongside the existing "get_pgcstack" entry

Context

Discovered via Mooncake.jl#982 — all check_allocs-based tests fail with false positives on Apple Silicon due to this missing entry. A downstream workaround was proposed in Mooncake.jl#1092 but fixing it here upstream is the right approach.

MWE (on arm64/Apple Silicon)

using AllocCheck
@check_allocs foo(x::Float64) = 2x
foo(1.0)
# Reports: Allocating runtime call to "jl_get_pgcstack_static" in unknown location

On arm64 (Apple Silicon), Julia uses `jl_get_pgcstack_static` instead of
`jl_get_pgcstack` to access the GC stack. This variant was missing from
the `fn_may_allocate` allowlist, causing spurious "1 allocation" reports
for every `@check_allocs`-decorated function on macOS/arm64.

Ref: chalk-lab/Mooncake.jl#982
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant