rt: Fix box annihilator to deallocate exchange heap boxes properly.

This commit is contained in:
Elliott Slaughter 2012-08-31 10:43:57 -07:00
parent f8323ac615
commit f022f566a4

View File

@ -197,7 +197,13 @@ annihilator::do_annihilate(rust_task *task, rust_opaque_box *box) {
annihilator annihilator(task, true, tydesc->shape,
tydesc->shape_tables, p);
annihilator.walk();
task->boxed.free(box);
// NB: A reference count of -1 indicates that this box lives on the
// exchange heap. Otherwise it lives on the task-local heap.
if (box->ref_count + 1 == 0) {
task->kernel->free(box);
} else {
task->boxed.free(box);
}
}
void