Odd Vector Resizing Problem

In a rather large program of mine, I have hit a snag. I get the following run time message:
This program has requested the runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I have found that the following line in my code causes the crash:
XFNLOD5.resize(2048);//XFNLOD5 is a std::vector<double>.

I have never run into this problem before, so for the past few hours I have been surfing the web trying to find a good answer/way to fix it. Somewhere it was suggested to use dynamic memory, so I tried:
double * XFNLOD5 = new double [2048];

However, that gave the same error message. Another person suggested that this error was due to having too much memory being used, but my the point it gets to this line, there is only about 10 MB of memory used. Plus, memory shouldn't be a big deal in my case, since I have a 64-bit 12 GB RAM computer.

Any suggestions?
double * XFNLOD5 = new double [2048];

Code is perfect, I think the way you are using this is wrong we don't know how many times is this code is calling.

Even if your PC having 12GB RAM, windows system allows only 2GB RAM for each process if you use proper settings it will be enabled to 4GB in 64bit system.
Don't use new[] here. Vector is the safer way to go.

resize can explode like that if you've stepped out of bounds of your vector previously in the code. It's possible that line is not the cause of the bug, it is just exposing it.

Does the bug happen regularly? Is it easy to reproduce? If so I would start by setting breakpoints on accesses to XFNLOD5 to make sure you're not stepping out of bounds anywhere.
Topic archived. No new replies allowed.