about summary refs log tree commit diff
path: root/src/rt/rust_box_annihilator.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-03-23 17:51:54 -0700
committerBrian Anderson <banderson@mozilla.com>2012-03-29 16:43:18 -0700
commit3a7a408386b8b1fbeb82cf6d695a168296c02793 (patch)
treed4716b29380eb27c3b361bd8ed12a3a22d1aa5d5 /src/rt/rust_box_annihilator.cpp
parent106c9faa59c1a605d7e0d67da5b45d24863ec009 (diff)
rt: Free all outstanding boxes at task death
Diffstat (limited to 'src/rt/rust_box_annihilator.cpp')
-rw-r--r--src/rt/rust_box_annihilator.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rt/rust_box_annihilator.cpp b/src/rt/rust_box_annihilator.cpp
new file mode 100644
index 00000000000..29c69aa1766
--- /dev/null
+++ b/src/rt/rust_box_annihilator.cpp
@@ -0,0 +1,15 @@
+#include "rust_internal.h"
+#include "rust_shape.h"
+
+void
+annihilate_boxes(rust_task *task) {
+    LOG(task, gc, "annihilating boxes for task %p", task);
+
+    boxed_region *boxed = &task->boxed;
+    rust_opaque_box *box = boxed->first_live_alloc();
+    while (box != NULL) {
+        rust_opaque_box *tmp = box;
+        box = box->next;
+        boxed->free(tmp);
+    }
+}