c++ - Stack overflow in VS multithreading -


when try create thread this

somefunc(void* param){ char currfile[500000]; char currkeyboard[24576];    char currimage[500000];  char curraddinfo[12000]; } _beginthread( somefunc, 0,null ); 

the program crash whith stackoverflow exception.but when this

    somefunc(void* param){ char currfile[500000]; char currkeyboard[24576];    char currimage[500000];  } _beginthread( somefunc, 0,null ); 

the program don`t crash.why?

the reason second function allocates less memory on stack first. way stuff allocate.

use vectors instead, they'll allocate on heap, , since manage own memory won't have to.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -