maximum size for an array of floats?

Hello,
I'm trying to process large amounts of data, so I've set up a series of arrays to achieve this.

However, I notice that my program crashes when I try to create an array of floats with more than 500,000 elements.

When I try to run a compiled program with this in it:

float myarray [600000];

I get an exception "your program has stopped working" message.

The size of such an array is almost exactly 2MB, so I suspect there is some artificial restriction on array sizes that I am not aware of. I am running windows 7 64bit with 8GB of ram, using dev-C++ bloodshed.

Thanks for the help!
It's a limit on how much stack memory your process gets. You could probably do it by using the heap instead.
Makes sense.
Cheers!
using the heap instead

what is heap? how to use it?
I understand the concept but I'm still a bit foggy on some specifics. For example, suppose I have a structure that I would declare like this:

1
2
3
struct mystruct {
  int myarray [50];
};


can I now create an array of this structure on the heap by doing this:

mystruct * pointer = new mystruct [length]

if that's the case, what exactly does pointer now point to? Can I then access the ith structure of the array with *pointer[i]?
Last edited on
oh, that...
Pointer is pointing to an array of mystructs. If you want to access the ith element, you don't need the extra *, the [] already is dereferencing it for you.
Topic archived. No new replies allowed.