Skip to content

Commit d7db25e

Browse files
author
Eric Holk
committed
Added an environment variable to override the minimum stack size. Closes #637.
1 parent 4c0a2ed commit d7db25e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/rt/rust_task.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,22 @@
1515
// FIXME (issue #151): This should be 0x300; the change here is for
1616
// practicality's sake until stack growth is working.
1717

18-
static size_t const min_stk_bytes = 0x200000;
18+
static size_t get_min_stk_size() {
19+
char *stack_size = getenv("RUST_MIN_STACK");
20+
if(stack_size) {
21+
return atoi(stack_size);
22+
}
23+
else {
24+
return 0x200000;
25+
}
26+
}
1927

2028
// Task stack segments. Heap allocated and chained together.
2129

2230
static stk_seg*
2331
new_stk(rust_task *task, size_t minsz)
2432
{
33+
size_t min_stk_bytes = get_min_stk_size();
2534
if (minsz < min_stk_bytes)
2635
minsz = min_stk_bytes;
2736
size_t sz = sizeof(stk_seg) + minsz;

0 commit comments

Comments
 (0)