Don't store the pois of OTP modules in ets at startup #881
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
They take up a lot of memory, duplicated for each project, and most of them not
used. They will be reloaded and inserted when needed by calling
els_utils:lookup_document/1
so there is no information loss.OTP modules are outside of the project root, so for example if one jumps to the definition of an OTP function and opens an OTP module it will start a new ELS node. Hence the POIs of OTP modules in a non-OTP project are mostly unused. (One exception I noticed when showing hover-docs, it fetches the function heads and so it currently loads and stores the module again)
This is just a quick fix - On the long term there could be a different, limited set of info stored for OTP modules, only those which are for referencing but nothing that is about the implementation.
I observed the below memory reduction with this change when opening a file in erlang_ls (using OTP 21.3.8.2)