Skip to content

Commit

Permalink
rt: Fix box annihilator to deallocate exchange heap boxes properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Elliott Slaughter committed Aug 31, 2012
1 parent f8323ac commit f022f56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rt/rust_box_annihilator.cpp
Expand Up @@ -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
Expand Down

0 comments on commit f022f56

Please sign in to comment.