Pkg folders get bigger after each minor version release

When there’s a new minor release of Julia, and Pkg does a fresh precompile of all the installed packages, it doesn’t seem to delete the old files. After updating from 1.10.4 to 1.10.5, the .julia/compiled/v1.10 folder went up from 450MB to about 700MB. It gets bigger every time - after each release, 1.10.2, 1.10.3, etc., it creates new precompiled files without cleaning up the old ones.

If you go into the folder and pick a package you’ll see repeated copies of the same files with different names - ones created for each 1.10.x version of Julia.

But if I delete the whole folder and make it precompile everything again, the folder is only 350MB now. So why doesn’t Pkg (or perhaps juliaup) clean up after itself and delete the old ones to stop the folder from getting bigger and bigger?

3 Likes

Yes, regularly deleting the compiled dir is a must. It’s not only the Julia versions updates. Packages updates may contribute to that too. For me I went down from > 5GB to 1.6 GB.

1 Like

There’s also Pkg.gc()

It doesn’t lead to any visible effect.

IIRC, Julia tracks environments (Manifest.toml files) that you’ve used in the past. If these manifests still exist, they will force Pkg to keep the referenced versions of packages, even if you do Pkg.gc(). (Although I thought we improved this at some point and added a time criterion as well. Don’t know exactly.)

Yeah, but the Pkg GC only keeps track by packages and their versions — this is about how each package version itself will get multiple compiled copies depending upon the version of Julia you use. It’s all dependent upon knowing which Manifests exist — and the Manifests themselves only strongly enforce the exact package version.

I think the time-based criterion is still an open feature idea: JuliaLang/Pkg.jl#2684.

3 Likes

While developing using both a regular REPL and the one in VSC I get permanent re-recompilations. Regularly I have to check and clean the package compiled dir that easily accumulates dlls up to 1 GB (each one is ~60 MB in v1.10 and 90 in 1.11). On 1.11 Makie precompiled dll is > 200 MB. Not difficult to find huge disk space usage there as well.