* Adam Hartshorne:
Hi,
I have the following problem, I have used the boost library (
boost::multi_array<float,2>) of size X by X. I initialise this using the
following line
typedef boost::multi_array<float, 2> array_type;
array_type D(boost::extents[num_vertices][num_vertices]);
This works fine up to a size of 5000 x 5000 then my program crashes at
the definition stage due to memory requirements. I am assuming the
boost::extents call stops my program creating a multi array of a size
bigger than 5000 x 5000. However in certain situations I need a bigger
2D array, any thoughts on how I can achieve this?
You are probably allocating the array as a local variable.
That's 25 million floats, probably 100 million bytes, locally.
First, think about whether you really need an array that large, or at
all. It is typical for this question that the array isn't actually
needed. If, against expectation, it turns out to be needed, try to
allocate the array dynamically instead, using 'new', and keep in mind
how much memory you have, and that it's just a very very short step to
the case where instead you should be dealing with disk storage.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?