Skip to content

Commit 06f4cb4

Browse files
committed
rt: Delete the entire stack chain on task destruction
Unwinding through __morestack on 64-bit Linux seems to be no big deal, and all we have to do is free the stacks to make unwinding work with split stacks.
1 parent 766e29c commit 06f4cb4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/rt/rust_task.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ rust_task::~rust_task()
178178
I(sched, ref_count == 0); // ||
179179
// (ref_count == 1 && this == sched->root_task));
180180

181-
del_stk(this, stk);
181+
// Delete all the stacks. There may be more than one if the task failed
182+
while (stk != NULL) {
183+
del_stk(this, stk);
184+
}
182185
}
183186

184187
struct spawn_args {

src/test/run-fail/morestack1.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// xfail-test
22
// compile-flags:--stack-growth
3+
// error-pattern:explicit failure
34
fn getbig(i: int) {
45
if i != 0 {
56
getbig(i - 1);
@@ -9,5 +10,5 @@ fn getbig(i: int) {
910
}
1011

1112
fn main() {
12-
getbig(10000000);
13+
getbig(100000);
1314
}

0 commit comments

Comments
 (0)