Skip to content

Add get_pgcstack_static to non-allocating allowlist#100

Merged
topolarity merged 2 commits into
JuliaLang:mainfrom
sunxd3:fix/get-pgcstack-static
Jun 8, 2026
Merged

Add get_pgcstack_static to non-allocating allowlist#100
topolarity merged 2 commits into
JuliaLang:mainfrom
sunxd3:fix/get-pgcstack-static

Conversation

@sunxd3

@sunxd3 sunxd3 commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

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
@topolarity topolarity force-pushed the fix/get-pgcstack-static branch from 09d2dce to 11f4dba Compare June 8, 2026 23:24

@topolarity topolarity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix-up @sunxd3 !

Sorry for the delay in reviewing, let's get this out to the masses

@topolarity topolarity merged commit aeec101 into JuliaLang:main Jun 8, 2026
6 checks passed
@sunxd3 sunxd3 deleted the fix/get-pgcstack-static branch June 9, 2026 10:43
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.

2 participants