title: Setting the default stack size on Linux globally for the program
body: <p>So I've noticed that the default stack size for threads on linux is 8MB (if I'm wrong, PLEASE correct me), and, incidentally, 1MB on Windows. This is quite bad for my application, as on a 4-core processor that means 64 MB is space is used JUST for threads! The worst part is, I'm never using more than 100kb of stack per thread (I abuse the heap a LOT ;)).</p>
  
  <p>My solution right now is to limit the stack size of threads. However, I have no idea how to do this portably. Just for context, I'm using Boost.Thread for my threading needs. I'm okay with a little bit of #ifdef hell, but I'd like to know how to do it easily first.</p>
  
  <p>Basically, I want something like this (where windows_* is linked on windows builds, and posix_* is linked under linux builds)</p>
  
  <pre><code>// windows_stack_limiter.c
  int limit_stack_size()
  {
      // Windows impl.
      return 0;
  }
  
  // posix_stack_limiter.c
  int limit_stack_size()
  {
      // Linux impl.
      return 0;
  }
  
  // stack_limiter.cpp
  int limit_stack_size();
  static volatile int placeholder = limit_stack_size();
  </code></pre>
  
  <p>How do I flesh out those functions? Or, alternatively, am I just doing this entirely wrong? Remember I have no control over the actual thread creation (no new params to CreateThread on Windows), as I'm using Boost.Thread.</p>