Skip to content

Space leak in persistentHieFileRule #1946

Open
@pepeiborra

Description

@pepeiborra

(currentSource,ver) <- liftIO $ do
mvf <- getVirtualFile vfs $ filePathToUri' file
case mvf of
Nothing -> (,Nothing) . T.decode encoding <$> BS.readFile (fromNormalizedFilePath file)
Just vf -> pure (Rope.toText $ _text vf, Just $ _lsp_version vf)
let refmap = generateReferencesMap . getAsts . hie_asts $ res
del = deltaFromDiff (T.decode encoding $ hie_hs_src res) currentSource
pure (HAR (hie_module res) (hie_asts res) refmap mempty (HieFromDisk res),del,ver)

del in line 512 keeps two large byte strings alive:

  • source code of the .hs file on disk
  • source code recorded in the .hie file

This is leaked for all the modules in the project with an entry in the hiedb and a .hie file (all in most circumstances).

The memory leak is not flushed until the HieAstResult is actually used and the PositionMapping is forced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceIssues about memory consumption, responsiveness, etc.type: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions