Fix memory thrash after enabling Snapshot() in StateDB interface
1. Detach working set from block after it is being committed
2. Continue to investigate why/where reference to blocks kept being held
@@ -1016,6 +1016,8 @@ func (bc *blockchain) commitBlock(blk *Block) error {
sfTimer := bc.timerFactory.NewTimer("sf.Commit")
err := bc.sf.Commit(blk.workingSet)
sfTimer.End()
+ // detach working set so it can be freed by GC
+ blk.workingSet = nil
if err != nil {
return err
}
