When working with huge matrices, the limitations of the RAM is a real issue, and one would like to perform matrix operations in place if possible. Given a matrix A which occupies a sizable chunk of RAM, what is the best way to perform the following operations

A.*=2;
A.+= A';

so that it is done in-place. I noticed that in spite of using the . notation, the RAM usage increases by at least 100%, indicating that Julia is creating a copy of the matrix.

symmetrize!(a) = begin
for c in 1:size(a, 2)
for r in c:size(a, 1)
a[r, c] += a[c, r]
a[c, r] = a[r, c]
end
end
a
end
using BenchmarkTools
a = rand(2500,2500) ;
@btime symmetrize!($a);
@btime $a .+ $a';