Skip to content

Commit 5747fe7

Browse files
committed
rt: For now, only run the box annihilator after task failure
1 parent 7f9ed39 commit 5747fe7

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/rt/rust_task.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ cleanup_task(cleanup_args *args) {
9696
bool threw_exception = args->threw_exception;
9797
rust_task *task = a->task;
9898

99-
cc::do_cc(task);
100-
annihilate_boxes(task);
101-
cc::do_final_cc(task);
102-
103-
task->die();
104-
10599
{
106100
scoped_lock with(task->kill_lock);
107101
if (task->killed && !threw_exception) {
@@ -110,6 +104,20 @@ cleanup_task(cleanup_args *args) {
110104
}
111105
}
112106

107+
// FIXME: For performance we should do the annihilator instead
108+
// of the cycle collector even under normal termination, but
109+
// since that would hide memory management errors (like not derefing
110+
// boxes), it needs to be disableable in debug builds.
111+
if (threw_exception) {
112+
// FIXME: When the annihilator is more powerful and successfully
113+
// runs resource destructors, etc. we can get rid of this cc
114+
cc::do_cc(task);
115+
annihilate_boxes(task);
116+
}
117+
cc::do_final_cc(task);
118+
119+
task->die();
120+
113121
task->notify(!threw_exception);
114122

115123
if (threw_exception) {

0 commit comments

Comments
 (0)