[space map] fix accounting of allocatable blocks (#98)

Preserve the input block first to avoid reusing it in subsequent
shadow operations, e.g., shadow another block when releasing
a recursive lock. (issue #97)
This commit is contained in:
Ming-Hung Tsai 2018-06-07 14:45:37 +08:00 committed by Joe Thornber
parent 6a7351da0d
commit 4b08c7793d

View File

@ -68,10 +68,10 @@ namespace {
} }
virtual void dec(block_address b) { virtual void dec(block_address b) {
sm_->dec(b); if (sm_->get_count(b) == 1)
if (!sm_->get_count(b))
mark_freed(b); mark_freed(b);
sm_->dec(b);
} }
virtual maybe_block find_free(span_iterator &it) { virtual maybe_block find_free(span_iterator &it) {