My current .julia is 34 GB and seems to be growing indefinitely.
] gc removed measly 24 MB.
From a user perspective, this is pretty unadaptable. It cannot be the solution to run a cron job and nuke the folder every week.
My current .julia is 34 GB and seems to be growing indefinitely.
] gc removed measly 24 MB.
From a user perspective, this is pretty unadaptable. It cannot be the solution to run a cron job and nuke the folder every week.
The first question is, where is the memory usage coming from. On my machine I use the following command:
cd .julia
du -k --max-depth=2 . |
awk '
match($2, /v[0-9]+(\.[0-9]+)+/) {
version = substr($2, RSTART, RLENGTH)
kib[version] += $1
}
END {
for (version in kib)
print kib[version] * 1024, version
}
' |
sort -k2 |
numfmt --field=1 --to=iec --format="%.1f"
which has the output:
7.3G v1.10
25.0G v1.11
24.9G v1.12
22.3G v1.13
4.8G v1.14
I could start with deleting the subfolders for the Julia version I don’t use any longer (not doing that because I have enough disk space).
The next step could be to delete the packages that you only tried out, but not longer use. Start to look at the global environment. On my machine:
julia> using Pkg; Pkg.status()
Status `~/.julia/environments/v1.14/Project.toml`
⌃ [208986ce] DocBrowser v0.1.1
⌃ [5ee84a8c] KaimonGate v1.7.2
[16fef848] LiveServer v1.6.0
[89398ba2] LocalRegistry v0.5.7
[295af30f] Revise v3.18.0
Info Packages marked with ⌃ have new versions available and may be upgradable.
This looks pretty clean, not much to delete here.
Then you could look at the environments of the projects you use most.
You can also use the command:
du -h --max-depth=2 -c .julia
to get a better understanding where the space is going.
If you are on Windows, use a git bash terminal to run the commands.
It is not about finding things to delete but the user experience of having to do this myself.
Python takes the other approach of having everything a project environment needs into the project. If I update it, the old stuff is gone, if I stop working on the project and remove it, all dependencies are gone too. Not so in Julia.
Well, the advantage of the Julia approach is that multiple project can use the same packages (src+compiled+artifacts), you avoid duplication.
If you have suggestions how to make the cleanup easier, please share them. We could add commands to the package manager:
Would that help?
Julia needs to track Manifest files. If a package version is in no Manifest anymore it needs to be removed, same for artifacts and compiled code. If a package is updated and the old version is in no other environment it is dead code. Same story if a project is deleted. Not sure who does that but my solution is a monthly cron that nukes compiled, artifacts and packages.
There’s GitHub - giordano/PkgCleanup.jl: Cleanup unused Julia environments and artifacts · GitHub for a user-friendly solution. Agree that something like this should be built-in to make it more discoverable.