Stream: helpdesk (published)

Topic: ✔ precompilation directives cause allocations


view this post on Zulip Leandro Martínez (Aug 21 2023 at 15:47):

I just added precompilation directives (using PrecompileTools) to a package, and in Julia 1.6 a bunch of tests started failing because, with the precompilation directives a series of functions start allocating, while without them the functions do not allocate.

I can reproduce the problem exactly: remove the precompilation directives, the tests pass (the functions do not allocate). Add the precompilation directives, the functions start allocating and the tests fail.

That happens in 1.6 but not 1.10. In 1.10 I have no such issues.

So, I have two questions:

1) Is this something known? I find hard to even start debugging that.
2) How can precompilation affect the behavior of a function?

view this post on Zulip Leandro Martínez (Aug 21 2023 at 15:57):

(currently just worked around that by only precompiling if version > 1.9, but still the observation is strange)

view this post on Zulip Leandro Martínez (Aug 21 2023 at 16:48):

Followup: https://discourse.julialang.org/t/precompiletools-precompilation-causing-allocations-in-julia-1-6-7/103039/2?u=lmiq

view this post on Zulip Gunnar Farnebäck (Aug 21 2023 at 19:14):

It's certainly known. See e.g. https://github.com/JuliaLang/julia/issues/35972.

view this post on Zulip Notification Bot (Aug 21 2023 at 19:40):

Leandro Martínez has marked this topic as resolved.


Last updated: Dec 28 2024 at 04:38 UTC