Also running Julia v1.5 on a mac. Executing it using Juno/Atom in a global scope. Just inspecting memory using the system monitor. Any suggestions for a better way of inspecting memory usage?
If I replace the random index with i = 1 then the problem goes away. So maybe it has something to do with the creation of the different UnitRange objects on each call?
Figured out the problem. I guess the expression v = Array{Float32}(undef, 105, 80, 4, 50000) does not actually allocate the full block of memory because of the undef initializer. It was therefore allocating as it was used which made the memory footprint grow up to what it would have if the allocation actually happened at the beginning.