How to increase stack size of c++ in ubuntu?
Difference between en1 and en2, changed 145 character(s)
I usually write: ↵
↵
'#define N 1000000↵
↵
vector<int> adj[N];↵
↵
But when I run it locally, I get segmentation fault due to stack size being too small, so I end up reducing N to something like 10000 and forget to change it back again before submitting, causing unnecessary penalties. ↵
↵
↵
↵
So is there anyway to permanently increase stack size in ubuntu?↵
↵
g++ -Wl,--stack=268435456 file.cpp works in Windows.↵
↵
ulimit -s unlimited only increases stack size for the specific terminal 
↵
↵
UPD:↵
↵
Thanks a lot for your replies, I ended up spilling water on my laptop :(↵
↵
I'll try the suggestions when (if?) My laptop gets dried.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Slow_But_Determined 2018-11-13 14:02:01 145
en1 English Slow_But_Determined 2018-11-12 22:02:37 533 Initial revision (published)