I was hoping that GC would free some memory, and I noticed that it does not works when I’m using
@btime. Here, a basic example
using BenchmarkTools function a(N) x = rand(N) @time y = sin.(x) x = 1; y = 1; GC.gc() end function b(N) x = rand(N) @btime y = sin.($x) x = 1; y = 1; GC.gc() end a(10^8) GC.gc() # actually clears the memory b(10^8) GC.gc() # does not clears the memory
There are two points that I would like to understand.
I can see in my System Monitor that memory is available only when I run GC on the REPL, so, why does the GC.gc() does not free memory inside my
bfunction ? In this a feature of GC ?
I need to exit Julia to get memory after using my
bfunction. What does the
@btimehas in special that does not allow the GC to work ?
For reference, I’m using Julia v 1.0 on Ubuntu