I added:
if Sys.free_memory()/2^30 < 6.0
GC.gc()
end
to large functions that are called by pmap…
I think there is a bug in the garbage collector, this should not be needed…
Created a bug report: Garbage collector not working · Issue #50658 · JuliaLang/julia · GitHub