Memory leak with BenchmarkTools?

I make numerous calls to @belapsed within a loop and I see the memory consumption constantly increasing…

Anybody experienced such problem ?`

1 Like

It will probably keep piling up until GC decides it is time for some GCing.

Well, I am not sure. After a talk with @ffevotte, it could be caused by the creation of a lot of not-so-temporary functions created via calls like t=@belapsed $f($operands...) that I use inside my own bench function taking a function variable f for argument…

Are you interpolating new variables in the loop? This will likely make new functions that refer to these variables and these will not be reclaimed

Yes, there are new variables but with the same type… I do not really understand why it creates new functions (f exists).

To make the function benchmarked look like a normal function with a local variable.

OK, I think I understand your point. So I can’t really figure how to create a lot of benchmark curves with BenchmarkTools… Maybe I should launch new Julia processes within Julia (Distributed with add and rm procs ?)