Skip to content

Commit 098011a

Browse files
committed
avoid holding onto the hie bytestring when indexing
1 parent 369373e commit 098011a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ghcide/src/Development/IDE/Core/Compile.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,15 @@ spliceExpresions Splices{..} =
528528
-- can just increment the 'indexCompleted' TVar and exit.
529529
--
530530
indexHieFile :: ShakeExtras -> ModSummary -> NormalizedFilePath -> Fingerprint -> Compat.HieFile -> IO ()
531-
indexHieFile se mod_summary srcPath hash hf = do
531+
indexHieFile se mod_summary srcPath !hash hf = do
532532
IdeOptions{optProgressStyle} <- getIdeOptionsIO se
533533
atomically $ do
534534
pending <- readTVar indexPending
535535
case HashMap.lookup srcPath pending of
536536
Just pendingHash | pendingHash == hash -> pure () -- An index is already scheduled
537537
_ -> do
538+
-- hiedb doesn't use the Haskell src, so we clear it to avoid unnecessarily keeping it around
539+
let !hf' = hf{hie_hs_src = mempty}
538540
modifyTVar' indexPending $ HashMap.insert srcPath hash
539541
writeTQueue indexQueue $ \db -> do
540542
-- We are now in the worker thread
@@ -547,7 +549,7 @@ indexHieFile se mod_summary srcPath hash hf = do
547549
Just pendingHash -> pendingHash /= hash
548550
unless newerScheduled $ do
549551
pre optProgressStyle
550-
addRefsFromLoaded db targetPath (RealFile $ fromNormalizedFilePath srcPath) hash hf
552+
addRefsFromLoaded db targetPath (RealFile $ fromNormalizedFilePath srcPath) hash hf'
551553
post
552554
where
553555
mod_location = ms_location mod_summary

0 commit comments

Comments
 (0)