File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,6 @@ cleanup_task(cleanup_args *args) {
96
96
bool threw_exception = args->threw_exception ;
97
97
rust_task *task = a->task ;
98
98
99
- cc::do_cc (task);
100
- annihilate_boxes (task);
101
- cc::do_final_cc (task);
102
-
103
- task->die ();
104
-
105
99
{
106
100
scoped_lock with (task->kill_lock );
107
101
if (task->killed && !threw_exception) {
@@ -110,6 +104,20 @@ cleanup_task(cleanup_args *args) {
110
104
}
111
105
}
112
106
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
+
113
121
task->notify (!threw_exception);
114
122
115
123
if (threw_exception) {
You can’t perform that action at this time.
0 commit comments