TranspositionTable { void sweep() { Logging.log("Nodes in use " + nodesInUse + "/" + table.length + " (" + (nodesInUse* 100)/table.length + "%)"); for (int i = 0; i < table.length; i++) { final SearchNode node = table[i]; if (node.isInUse()) { if (node.isMarked()) { node.setMarked(false); } else { ListNode<SearchNode> n = node.getChildren(); while (n != null) { n = listNodes.free(n); } node.free(); nodesInUse--; } } } } TranspositionTable(int megabytes, SearchNodeBuilder builder,
			CoordinateSystem coords); int dagSize(SearchNode root); synchronized SearchNode findIfPresent(long fancyHash);  }
@Test public void testSweep() { SearchNode a = table.findOrAllocate(0L); SearchNode b = table.findOrAllocate(1L); SearchNode c = table.findOrAllocate(2L); SearchNode d = table.findOrAllocate(3L); SearchNode e = table.findOrAllocate(4L); table.addChild(a, b); table.addChild(b, c); table.addChild(b, d); table.addChild(c, e); table.addChild(d, e); table.markNodesReachableFrom(b); table.sweep(); assertNull(table.findIfPresent(0L)); assertEquals(b, table.findIfPresent(1L)); assertEquals(c, table.findIfPresent(2L)); assertEquals(d, table.findIfPresent(3L)); assertEquals(e, table.findIfPresent(4L)); }