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

Precompile scripts leaves files behind #4869

Closed
giordano opened this issue Jan 16, 2024 · 1 comment · Fixed by #4870
Closed

Precompile scripts leaves files behind #4869

giordano opened this issue Jan 16, 2024 · 1 comment · Fixed by #4870
Labels

Comments

@giordano
Copy link
Contributor

Plots.jl/src/init.jl

Lines 102 to 112 in 0d95673

fn = tempname()
pl = current()
show(devnull, pl)
# FIXME: pgfplotsx requires bug
backend_name() === :pgfplotsx && return
if backend_name() === :unicodeplots
savefig(pl, "$fn.txt")
return
end
showable(MIME"image/png"(), pl) && savefig(pl, "$fn.png")
showable(MIME"application/pdf"(), pl) && savefig(pl, "$fn.pdf")
The way you're using tempname(), by not using the name as is but appending an extension, causes the cleanup of the file to never happen, and so repeatedly precompiling the package causes lots of files to pile up, especially on shared systems which are reboot infrequently.

Instead, you should probably be creating a temporary directory with mktempdir() and write files in there, to make sure everything inside the directory is cleaned up at the end of the process.

@giordano
Copy link
Contributor Author

giordano commented Nov 8, 2024

Why this is still an issue in v1.40.8 which was released 7 months after #4870 was merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant