diff options
| author | Eric Holk <eholk@mozilla.com> | 2011-07-08 11:34:42 -0700 |
|---|---|---|
| committer | Eric Holk <eholk@mozilla.com> | 2011-07-08 11:36:56 -0700 |
| commit | d7db25e8f60af6894556a14cd420f7523f33e89b (patch) | |
| tree | 7dd1ddfa6819d9672cb9a9618692088a13bfe5d6 /src/rt/rust_task.cpp | |
| parent | 4c0a2ed378cfdf5528cec813f1e02a42891edb2a (diff) | |
| download | rust-d7db25e8f60af6894556a14cd420f7523f33e89b.tar.gz rust-d7db25e8f60af6894556a14cd420f7523f33e89b.zip | |
Added an environment variable to override the minimum stack size. Closes #637.
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 70afcdd9d58..e0ae1ff367f 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -15,13 +15,22 @@ // FIXME (issue #151): This should be 0x300; the change here is for // practicality's sake until stack growth is working. -static size_t const min_stk_bytes = 0x200000; +static size_t get_min_stk_size() { + char *stack_size = getenv("RUST_MIN_STACK"); + if(stack_size) { + return atoi(stack_size); + } + else { + return 0x200000; + } +} // Task stack segments. Heap allocated and chained together. static stk_seg* new_stk(rust_task *task, size_t minsz) { + size_t min_stk_bytes = get_min_stk_size(); if (minsz < min_stk_bytes) minsz = min_stk_bytes; size_t sz = sizeof(stk_seg) + minsz; |
