I have the following code that throws an exception std::bad_alloc:
std::vector<std::vector<double>> myVector(nlines);
for(int i = 0; i < nlines; i++)
{
try
{
std::vector<double> iVector(ncolumns);
myVector[i] = iVector;
}
catch (std::exception& e)
{
}
}
}
This code works when it nlinesis around 500,000 ( ncolumnsusually less than 10), but when I tried this in a full-sized dataset, where nlines= 2,600,000, I get a bad_alloc exception.
I have 12 GB of memory and I look at the use of my memory when the program starts, it goes from 28% (before launch) to 42% (when an exception is raised). So it looks like I still have available memory.
, , . , MSDN, ( ), . . 2000000000 (2 ), .
, ++ ( CLI) interop #.NET. ++. , .NET- .
.