about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-03-26 14:39:39 -0700
committerBrian Anderson <banderson@mozilla.com>2012-03-29 16:43:18 -0700
commit5747fe7a2c0df47da1e062e81988707d9209bb7e (patch)
tree75ee9582fa90872280f46a14ce1f323831509c53
parent7f9ed39040404c59131ba3818e1ca947fb23d282 (diff)
downloadrust-5747fe7a2c0df47da1e062e81988707d9209bb7e.tar.gz
rust-5747fe7a2c0df47da1e062e81988707d9209bb7e.zip
rt: For now, only run the box annihilator after task failure
-rw-r--r--src/rt/rust_task.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index fbfee499e40..d77c7cf733e 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -96,12 +96,6 @@ cleanup_task(cleanup_args *args) {
     bool threw_exception = args->threw_exception;
     rust_task *task = a->task;
 
-    cc::do_cc(task);
-    annihilate_boxes(task);
-    cc::do_final_cc(task);
-
-    task->die();
-
     {
         scoped_lock with(task->kill_lock);
         if (task->killed && !threw_exception) {
@@ -110,6 +104,20 @@ cleanup_task(cleanup_args *args) {
         }
     }
 
+    // FIXME: For performance we should do the annihilator instead
+    // of the cycle collector even under normal termination, but
+    // since that would hide memory management errors (like not derefing
+    // boxes), it needs to be disableable in debug builds.
+    if (threw_exception) {
+        // FIXME: When the annihilator is more powerful and successfully
+        // runs resource destructors, etc. we can get rid of this cc
+        cc::do_cc(task);
+        annihilate_boxes(task);
+    }
+    cc::do_final_cc(task);
+
+    task->die();
+
     task->notify(!threw_exception);
 
     if (threw_exception) {