How to use a big GLfloat array to display a dense mesh model?

Dear All:
I want to display a 3d facial mesh(50496 vertices and 106466 faces). I use the code of OpenGL SuperBible just like this:

GLBatch PlyBatch;
void SetupRC()
{

GLfloat mVertex[10646633];
GLfloat mColor[10646633];

PlyBatch.Begin(GL_TRIANGLES, 106466);
PlyBatch.CopyVertexData3f(mVertex);
PlyBatch.CopyColorData4f(mColor);
PlyBatch.End();

}
and draw scene using this:
void RenderScene()
{

PlyBatch.Draw();

}
but when allocating the array mVertex[10646633]; there is a program error. When i reduce the array to mVertex[1500033], it’s all ok.
How to allocate a big GLfloat array?

If I understand the code correctly you allocate x3 entries for your color array but then copy x4 values, accessing undefined memory.

Because you’ve declared mVertex & mColor as local variables, they will be assigned on the stack. IIRC the default maximum stack size is ~1MB so you will get a stack overflow as both variables are about 3.8MB. You could declare them in a way so that they are created on the heap instead (global variable/static/allocate at run-time using new/delete) or perhaps increase the size of the stack.

Yes,it is an error.Thank you!

Thank you! i will try it