Re: how to use malloc to reserve space for 1 billion floats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/08/12 05:58, Anna Sidera wrote:
> The system has 10 giga byte RAM.
>
> The command:
> uname -a
> gives the following output:
> Linux olympus 2.6.26-2-amd64 #1 SMP Wed Aug 19 22:33:18 UTC 2009 x86_64 GNU/Linux
> I think this means that the system is 64 bit.
It does.

> So you think that the command:
> int myvariable = 1000;
> float *myarray = malloc(pow(myvariable,3)*sizeof(float));
> will work if pow(myvariable,3) is smaller than 2 billion?
>
> Many Thanks,
> Anna
Yes. (the 2+e9 limit being roughly for the 7,45GB needed, not due to
malloc, to which you
could ask for even bigger amounts )



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux