Memory allocation for sparse matrix multiplication

Dear folks,

This is my first post, so feel free to relocate me to an appropriate tag/ group/ domain, etc. etc.
So I have the following questions: 1) How can I estimate the amount of memory needed for the multiplication of two sparse matrices, given their sparsity and size 2) how can I do that more memory-efficient for the calculation of a projector? Have a look at the following code:

using LinearAlgebra
using SparseArrays
N = 200000
d = 1e-4
A = sprand(N,N,d)
@time P = A*A'

This works out, but it takes much more memory than I anticipated.
Thanks in advance!

The probability of any element in P being nonzero is the probability that there is any index into the corresponding row and column in A and A’ where both values are nonzero (with the exception of the diagonal entries of P, which are all nonzero). That’s approximately N*d*d, which for your values is about 0.002. Given how sparse matrices are stored that means P should need about N*N*0.002*2*8 bytes of memory, plus a bit more for the column pointers. That’s ballpark 1.3 GB.