Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Clean up tern web workers whenever we re-init the tern server, or close ... #3983

Merged
merged 3 commits into from
May 24, 2013

Conversation

eztierney
Copy link
Contributor

...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.

…se 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.

var MAX_TEXT_LENGTH = 1000000, // about 1MB
MAX_FILES_IN_DIR = 100,
MAX_FILES_IN_PROJECT = 100;

/**
* Create a new tern server.
*/
function initTernServer(dir, files) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HAd to move this to satisfy JSLint

@dloverin
Copy link

done reviewing.

@ghost ghost assigned dloverin May 24, 2013
@julianasuh
Copy link
Contributor

Open to @dloverin.

dloverin pushed a commit that referenced this pull request May 24, 2013
Clean up tern web workers whenever we re-init the tern server, or close ...
@dloverin dloverin merged commit e664a00 into adobe:master May 24, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants