Clearing up memory

Hi, I had a question about clearing up memory by removing temporary variables that we have used. For example, if I create a huge matrix

julia> A = rand(100000,10000);

the memory usage on my RAM visibly increases. If I reassign A to be a Float64, as in

julia> A = 2.0;

it still does not clear up the memory. It would be useful if I could get rid of arrays or variables that are needed temporarily in the middle of big computations.

2 things. First, you should almost never be reassigning the types of variables. second, you can manually run a GC run with GC.gc(). Note you should not do this frequently.

but when you actually need that RAM, GC should kick in. There’s no point clearing unused RAM too eagerly.

Thank you for pointing me to the concept of “Garbage Collection”. I will learn more about it.

Thank you. I will learn more about “Garbage Collection”.