diff options
| author | Corey Richardson <corey@octayn.net> | 2013-11-13 05:21:38 -0500 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-01-24 22:30:00 -0800 |
| commit | dee7fa58dd4203a19b83ad47c3b0a0efb92c0e9a (patch) | |
| tree | adb1ec1b8219633b3a7d65611cd2a1648d658f61 /src/libstd/rt | |
| parent | 462f09e9494481456b22630cb42a3c0544a08625 (diff) | |
| download | rust-dee7fa58dd4203a19b83ad47c3b0a0efb92c0e9a.tar.gz rust-dee7fa58dd4203a19b83ad47c3b0a0efb92c0e9a.zip | |
Use `mmap` to map in task stacks and guard page
Also implement caching of stacks.
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/env.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libstd/rt/env.rs b/src/libstd/rt/env.rs index f3fa482b18c..729e377e1af 100644 --- a/src/libstd/rt/env.rs +++ b/src/libstd/rt/env.rs @@ -10,7 +10,7 @@ //! Runtime environment settings -use from_str::FromStr; +use from_str::from_str; use option::{Some, None}; use os; @@ -18,18 +18,25 @@ use os; // They are expected to be initialized once then left alone. static mut MIN_STACK: uint = 2 * 1024 * 1024; +/// This default corresponds to 20M of cache per scheduler (at the default size). +static mut MAX_CACHED_STACKS: uint = 10; static mut DEBUG_BORROW: bool = false; static mut POISON_ON_FREE: bool = false; pub fn init() { unsafe { match os::getenv("RUST_MIN_STACK") { - Some(s) => match FromStr::from_str(s) { + Some(s) => match from_str(s) { Some(i) => MIN_STACK = i, None => () }, None => () } + match os::getenv("RUST_MAX_CACHED_STACKS") { + Some(max) => MAX_CACHED_STACKS = from_str(max).expect("expected positive integer in \ + RUST_MAX_CACHED_STACKS"), + None => () + } match os::getenv("RUST_DEBUG_BORROW") { Some(_) => DEBUG_BORROW = true, None => () @@ -45,6 +52,10 @@ pub fn min_stack() -> uint { unsafe { MIN_STACK } } +pub fn max_cached_stacks() -> uint { + unsafe { MAX_CACHED_STACKS } +} + pub fn debug_borrow() -> bool { unsafe { DEBUG_BORROW } } |
