Permalink
Browse files

Crush that pesky GC bug.

  • Loading branch information...
1 parent 916729e commit 5c60947c335e2d66ad73ab9d9f349a34e9d8d37e @nominolo committed Oct 22, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 vm/memorymanager.cc
View
@@ -320,6 +320,18 @@ void MemoryManager::performGC(Capability *cap) {
if (block == NULL || block->getFlag(Block::kScavenged)) {
break; // we're done
} else {
+ // If the block we are evacuating into and the block we're
+ // scavanging is the same then it definitely must be the last
+ // block. Otherwise, we may finish scavenging the block
+ // and then continue to evacuate into it again. Those newly
+ // evacuated objects will then never get scavenged. Ouch!
+ //
+ // To avoid this problem, we only scavenge the first block if
+ // there is no second block.
+ if (block == closures_ && block->link_ &&
+ !block->link_->getFlag(Block::kScavenged))
+ block = block->link_;
+
while (block != NULL && !block->getFlag(Block::kScavenged)) {
scavengeBlock(block);
block = block->link_;

0 comments on commit 5c60947

Please sign in to comment.