Skip to content

Memory leak on completion #1529

@art-w

Description

@art-w

With OCaml 4.14 and the latest merlin (4.6-414 and git master (*)), when editing a file in the Irmin repository and querying for completion, the ocamlermlin-server quickly reaches >5go of memory usage in just a few seconds.

To reproduce, it's enough to edit this test file from the Irmin repository and insert a line anywhere, even at the very top:

let _ = Irmin_pack_unix. (* repeatedly ask for completion *)

From a quick look with @voodoos, it's not super clear if the typechecker is responsible for holding onto memory for too long, but it contributes to the size of the leak. For example in the test file, removing the functor instantiations in module Store = ... lowers how fast merlin is leaking by a lot. I'm guessing other projects are affected, but that the increasing memory consumption isn't noticeable if one doesn't abuse functors (?)

(*) I believe that @voodoos reproduced the issue on an older version of ocaml/merlin that predates the module shapes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions