Skip to content

avoid holding onto the hie bytestring when indexing #1947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cabal-version: 2.4
build-type: Simple
category: Development
name: ghcide
version: 1.4.0.1
version: 1.4.0.2
license: Apache-2.0
license-file: LICENSE
author: Digital Asset and Ghcide contributors
Expand Down
6 changes: 4 additions & 2 deletions ghcide/src/Development/IDE/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,15 @@ spliceExpresions Splices{..} =
-- can just increment the 'indexCompleted' TVar and exit.
--
indexHieFile :: ShakeExtras -> ModSummary -> NormalizedFilePath -> Fingerprint -> Compat.HieFile -> IO ()
indexHieFile se mod_summary srcPath hash hf = do
indexHieFile se mod_summary srcPath !hash hf = do
IdeOptions{optProgressStyle} <- getIdeOptionsIO se
atomically $ do
pending <- readTVar indexPending
case HashMap.lookup srcPath pending of
Just pendingHash | pendingHash == hash -> pure () -- An index is already scheduled
_ -> do
-- hiedb doesn't use the Haskell src, so we clear it to avoid unnecessarily keeping it around
let !hf' = hf{hie_hs_src = mempty}
modifyTVar' indexPending $ HashMap.insert srcPath hash
writeTQueue indexQueue $ \db -> do
-- We are now in the worker thread
Expand All @@ -547,7 +549,7 @@ indexHieFile se mod_summary srcPath hash hf = do
Just pendingHash -> pendingHash /= hash
unless newerScheduled $ do
pre optProgressStyle
addRefsFromLoaded db targetPath (RealFile $ fromNormalizedFilePath srcPath) hash hf
addRefsFromLoaded db targetPath (RealFile $ fromNormalizedFilePath srcPath) hash hf'
post
where
mod_location = ms_location mod_summary
Expand Down