Skip to content

Commit 6ffc6c5

Browse files
authored
avoid holding onto the hie bytestring when indexing (#1947)
* avoid holding onto the hie bytestring when indexing * bump minor version number
1 parent 4e6e964 commit 6ffc6c5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ghcide/ghcide.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cabal-version: 2.4
22
build-type: Simple
33
category: Development
44
name: ghcide
5-
version: 1.4.0.1
5+
version: 1.4.0.2
66
license: Apache-2.0
77
license-file: LICENSE
88
author: Digital Asset and Ghcide contributors

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)