From 3a7a408386b8b1fbeb82cf6d695a168296c02793 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 23 Mar 2012 17:51:54 -0700 Subject: rt: Free all outstanding boxes at task death --- src/rt/rust_box_annihilator.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/rt/rust_box_annihilator.cpp (limited to 'src/rt/rust_box_annihilator.cpp') 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); + } +} -- cgit 1.4.1-3-g733a5