juliaup icon indicating copy to clipboard operation
juliaup copied to clipboard

`juliaup gc` should remove `compiled` and `environments` folders that are no longer needed

Open numbermaniac opened this issue 1 year ago • 7 comments

I had Julia release 1.10.5 and beta 1.11rc3 both installed using Juliaup. I used juliaup remove release to remove the 1.10.5 installation, and then afterwards, used juliaup gc. To my surprise, the .julia/compiled/v1.10/ and .julia/environments/v1.10/ folders remained, which is significant because the first one was using 700MB of storage. I would've expected them to be deleted since they're no longer needed.

It would be great if juliaup gc could detect when such folders are no longer needed and remove them accordingly. Thank you!

(If it helps: Juliaup 1.17.4, macOS 14.6.1)

numbermaniac avatar Sep 06 '24 15:09 numbermaniac

My gut feeling is that we can/should do something about the .julia/compiled folder, but not .julia/environments. The compiled folder is really just a cache/optimization, so deleting that seems fine. But the environments folder is really user-controlled/created data, and I think we should just never delete anything there.

davidanthoff avatar Sep 06 '24 20:09 davidanthoff

Should imo be a part of Pkg.gc since that already handles artifacts and packages.

KristofferC avatar Sep 06 '24 20:09 KristofferC

But Pkg.gc presumably doesn't know which Julia versions are installed, right?

davidanthoff avatar Sep 06 '24 21:09 davidanthoff

Yeah - I assume a Pkg in one Julia installation wouldn't know what other Julia installations you have, so it would need to be managed by juliaup.

numbermaniac avatar Sep 11 '24 09:09 numbermaniac

Could potentially be a two-step thing where juliaup gc writes a file that marks something as potentially unused and then Pkg.gc uses that to figure out what can be deleted. But seems kind of slow to kick in then...

StefanKarpinski avatar Oct 07 '24 19:10 StefanKarpinski

We could also add a secret command to juliaup that Pkg.jl could use to get a list of all currently installed Julia versions. Pkg.gc could try to spawn that command then, and if it gets something useful back use that information to decide which folders to delete.

I think in general we are probably reaching a point where Juliaup and Pkg.jl should be more integrated and talk to each other.

davidanthoff avatar Oct 07 '24 19:10 davidanthoff

I think in general we are probably reaching a point where Juliaup and Pkg.jl should be more integrated and talk to each other.

Yes, it does seem like we're at that point.

StefanKarpinski avatar Oct 07 '24 19:10 StefanKarpinski