Boost logo

Ublas :

From: Peter Schmitteckert (peter_at_[hidden])
Date: 2008-01-26 08:13:28


nisha kannookadan schrieb:

> ((127^5)*5)*8 is the size in byte, which is used for all these entries,
> but why do we divide by 1024^3 and not by 10^9 to receive the memory in
> GB?
Since memory is often specified in Gibi bytes, instead of Giga bytes.
> I was able to allocate a matrix of size 140000*140000:
> matrix a(140000,140000),
> how is that possible?
> This would need 146 GB, but I acctually have only 32GB RAM.

Depending on your operating system new / malloc doesn't actually
allocate the memory. Many OS allocate the ressources when you're using
them for the first time. That is, the malloc doesn't fail,
and you can even use part of the matrix and your code will crash
when it wants to acess more then your (allowed) virtual memory.

Best regards,