diff --git a/src/Database/LSMTree/Internal.hs b/src/Database/LSMTree/Internal.hs index f72afee0b..352c48660 100644 --- a/src/Database/LSMTree/Internal.hs +++ b/src/Database/LSMTree/Internal.hs @@ -881,12 +881,17 @@ newCursor !offsetKey th = withOpenTable th $ \thEnv -> do -- references to each run, so it is safe. allocTableContent reg contentVar = do RW.withReadAccess contentVar $ \content -> do + let wb = tableWriteBuffer content + wbblobs = tableWriteBufferBlobs content + allocateTemp reg + (WBB.addReference wbblobs) + (\_ -> WBB.removeReference wbblobs) let runs = cachedRuns (tableCache content) V.forM_ runs $ \r -> do allocateTemp reg (Run.addReference r) (\_ -> Run.removeReference r) - pure (tableWriteBuffer content, runs) + pure (wb, runs) {-# SPECIALISE closeCursor :: Cursor IO h -> IO () #-} -- | See 'Database.LSMTree.Normal.closeCursor'.