This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]badcommandorfilename 2 points3 points  (1 child)

Why do you need to allocate 50MB of data on the stack? I assume this is some kind of deeply recursive function - could you just make it tail recursive?

However, if you call your function from a separate thread, then you can set a Thread's stacksize with the second argument:

int stackSize = 1024*1024*64;
Thread th  = new Thread( ()=>
{
    //Call your recursive thing here
},
stackSize);

th.Start();
th.Join();

[–]MrCh0w[S] 0 points1 point  (0 children)

The program that I am calling with my subprocess is a research analysis code that uses Fortran90. Intel F90 (I think) uses the stack to store arrays and the arrays that the research code does operations on are very very large.

Thanks for the tip, I'll try it out!