Re: Strange "Stack Overflow" message occurring with use of vector




"ralphey" <Trapp.Andrew@xxxxxxxxx> wrote in message
news:1168490662.609154.101710@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

Though I've gleaned quite a bit of helpful information from this forum,
this is the first time I've posted to it, and I'm hoping that someone
out there will be able to help me through a tough situation that I am
experiencing.

A bit of background:

In my C++ code (compiled with Visual Studio 2003), I take as input an n
by m size data array, analyze it, and then make use of a vector to
store a variable number of binary chains of fixed length m (e.g., m =
10, and a binary chain of length 10 would be: 0100101010). The code I
use to create the vector is as follows:

****Code snippet A****
vector<int> vec;
vec.reserve(1000000);
****Code snippet A****


Your default stack size is 1 MB. You are trying to reserve 4 MB.

You should be allocating the vector on the heap if you need a vector of this
size.

Brian




.