mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Clean up tern web workers whenever we re-init the tern server, or close a project.
If we don't call terminate on the worker, it appears that the worker, and all the memory it's using will never get collected. So when we were switching projects, we were leaving behind orphaned workers, resulting in a large memory leak. To enable re-initing the web worker I had to change around the logic - now the worker sends a message when it is done being init'ed and the main thread waits for that message before it starts sending messages to the workers.
This commit is contained in:
1 parent
1339fc9cd3
commit
f6fdc43434
4 files changed
+402
-375
No files matched your search
@@ -39,6 +39,7 @@ define(function (require, exports, module) {
|
||||
StringUtils = brackets.getModule("utils/StringUtils"),
|
||||
StringMatch = brackets.getModule("utils/StringMatch"),
|
||||
LanguageManager = brackets.getModule("language/LanguageManager"),
|
||||
ProjectManager = brackets.getModule("project/ProjectManager"),
|
||||
HintUtils = require("HintUtils"),
|
||||
ScopeManager = require("ScopeManager"),
|
||||
Session = require("Session"),
|
||||
@@ -621,6 +622,10 @@ define(function (require, exports, module) {
|
||||
.on(HintUtils.eventName("activeEditorChange"),
|
||||
handleActiveEditorChange);
|
||||
|
||||
$(ProjectManager).on("beforeProjectClose", function () {
|
||||
ScopeManager.handleProjectClose();
|
||||
});
|
||||
|
||||
// immediately install the current editor
|
||||
installEditorListeners(EditorManager.getActiveEditor());
|
||||
|
||||
|
||||
Reference in new issue
Block a user