-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(exthost/#3009): Call '$release*' APIs to clean-up extension host …
…cache (#3016) __Issue:__ There is a memory leak in our completion items, signature help, and codelens via the extension host - may be responsible for the `SIGABRT` described in #3009 (as this can occur when the JS heap is out of memory). __Defect:__ The extension host adds a layer on top of the language server protocol, to serve as a cache for several language features - this helps performance when resolving items. However, this caching layer relies on the client to notify it when the items are no longer in use, so they can be cleaned up. Onivim was missing this `release` step. __Fix:__ Bake in the call to `release` in all the relevant subscriptions. This involves picking up the `cacheId` which wasn't wired up in some places (like codelens), setting up the `release*` API, and passing it back on conclusion of the subscription. To test this fix - I flipped the `Cache.enableDebugLogging` flag in the extension host and initiated several completions. Before this fix, it's obvious the caches were simply growing endlessly: ``` CompletionItem cache size — 1 CompletionItem cache size — 1 CompletionItem cache size — 2 CompletionItem cache size — 2 SignatureHelp cache size — 1 CompletionItem cache size — 3 CompletionItem cache size — 3 CompletionItem cache size — 4 CompletionItem cache size — 4 SignatureHelp cache size — 2 ... CompletionItem cache size — 15 CompletionItem cache size — 15 CompletionItem cache size — 16 CompletionItem cache size — 16 CompletionItem cache size — 17 CompletionItem cache size — 17 SignatureHelp cache size — 8 CompletionItem cache size — 18 CompletionItem cache size — 18 CompletionItem cache size — 19 CompletionItem cache size — 19 ``` After this fix, though, we can observe that the cache gets cleaned: ``` CompletionItem cache size — 1 CompletionItem cache size — 1 CompletionItem cache size — 0 CompletionItem cache size — 0 CompletionItem cache size — 1 CompletionItem cache size — 1 CompletionItem cache size — 0 CompletionItem cache size — 0 SignatureHelp cache size — 1 SignatureHelp cache size — 0 ... CompletionItem cache size — 0 CompletionItem cache size — 0 SignatureHelp cache size — 1 SignatureHelp cache size — 0 ``` Related #3009 Related #1058
- Loading branch information
Showing
11 changed files
with
280 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.