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

Memory leak when repeatedly benchmarking #339

Open
LilithHafner opened this issue Oct 21, 2023 · 1 comment
Open

Memory leak when repeatedly benchmarking #339

LilithHafner opened this issue Oct 21, 2023 · 1 comment
Labels

Comments

@LilithHafner
Copy link
Contributor

I'm trying to benchmark sorting runtime as a function of input size. I have this function

using BenchmarkTools
function f(n)
    x = rand(Int, n)
    target = sort(x)
    y = copy(target)
    @belapsed sort!($y) setup=($y == $target || error("Bad sort"); copyto!($y, $x)) evals=1 gctrial=false samples=3
end

But that function is a significant memory leak (because of JuliaLang/julia#14495)

If I run times = f.(1594323:1594323+100) (100 data points), it leaks about 3.56 GB according to my OS's report of how much memory the Julia process is using. Repeated runs continue to leak until my system crashes.

Is there a way to run @belapsed without leaking memory?

@gdalle
Copy link
Collaborator

gdalle commented Oct 22, 2023

I am completely incapable of answering the question, so I'm hoping someone else will

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

No branches or pull requests

2 participants