I was able to allocate a single array having 2.6GB (ie. w/ 700200000
elements of type float)
Note that type 'float' does not have the same size on
all implementations. The total memory for that
many type 'float' objects could easily be different
on another system.
yet when I did a cpuinfo on my computer, it
showed a cache size of 256KB and 1GB of memory. What happened???
I suspect your platform uses some sort of virtual memory
mechanism. Microsoft Windows perhaps?
I
thought new returns a contiguous block of memory???
It does. But the address range of that memory need not
correspond to your platform's underlying 'real' addresses.
Your system will provide each program a certain size 'address
space'. That's the range of addresses which your program will
'see' (also subject to more adjustments by your C runtime).
As far as your question "how much can I allocate?", the
answer to that depends entirely upon the capabilites of
your platform and your C implementation. From the perspective
of your C implementation, the limit is the maximum value
representable by the type 'size_t', declared by <stdlib.h>
(and a few other headers).
-Mike