Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does gc work for Scratch spaces? #4152

Open
fonsp opened this issue Feb 10, 2025 · 0 comments
Open

How does gc work for Scratch spaces? #4152

fonsp opened this issue Feb 10, 2025 · 0 comments

Comments

@fonsp
Copy link
Member

fonsp commented Feb 10, 2025

Hi!

I am wondering how gc works for Scratch objects, exactly when will they get deleted? I have two specific questions:

1. Per object?

My package uses two objects, with:

module MyPackage
public f1, f2

function f1()
    Scratch.@get_scratch!("one")
end

function f2()
    Scratch.@get_scratch!("two")
end
end

A user called MyPackage.f1 recently, MyPackage.f2 two weeks ago, and never since. Will "two" get deleted when the user does gc? Or is it an all-or-nothing situation, where the objects only get deleted if the entire package MyPackage is not used in the past week?

2. collect_delay=Second(1) leaves some scratch spaces

I called Pkg.gc(collect_delay=Second(1)) in a terminal and I was surprised that some scratch spaces were still there. The .julia/scratchspaces folder still has three subfolders (from Pluto, Makie and Pkg I believe). Is this expected? I assumed that collect_delay=Second(1) would cause all scratch spaces to get deleted, since nothing was used in the past second.

Thanks! Let me know if my questions are unclear :) ☀

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

No branches or pull requests

1 participant