I have (I believe) a very classic problem with memory allocation using "new". Here is the piece of code I use:
float * _normals = NULL;
try{
_normals = new float[_x*_y*_z*3];
}catch(System::Exception ^ e){
Windows::Forms::MessageBox::Show("Normals:\n" + e->Message);
if(e->InnerException != nullptr && e->InnerException->Message != nullptr)
Windows::Forms::MessageBox::Show("Details:\n" + e->InnerException->Message);
_file->Close();
return 0;
}
I don't know if you can tell from this piece of code but this is a mixed of managed and unmanaged code program. I don't know if that matters.
Now, when I run this code and try to allocate, say, 256*256*128*3 floats it runs normally. When I go with 492*492*442 floats then it throws a "External component has thrown an exception" exception. This is around 1.2GB, right. My system has 6GB of ram and free around 3GB. Can you tell the problem from this information? Can I handle it? I read somewhere about program memory space. Maybe the program memory is not enough?(I don't know anything around that matter, If you can enlighten me)
Please ask if you need more information.
Thank you in advance