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? -

html - Unable to style the color of bullets in a list -

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