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

[js code hints] Kill and restart the codehint worker thread every 30 hint requests. #4025

Merged
merged 2 commits into from
May 30, 2013

Conversation

eztierney
Copy link
Contributor

This avoids some memory leaks that we were encountering. Still looking into those, but this should at least stabilize things and prevent the memory from growing so much it crashes brackets.

To avoid a noticeable performance hit when we restart the worker, we instead start a new worker, and only switch to it after it has finished intializing (including priming the pump). So when we switch between the old and new worker it should be unoticeable to the user.

Had to move around a lot of code in ScopeManager - there are not a lot of actual changes, but the diff is messy due to this.

This avoids some memory leaks that we were encountering.  Still looking into those, but this should at least stabilize things and prevent the memory from growing so much it crashes brackets.

To avoid a noticeable performance hit when we restart the worker, we instead start a new worker, and only switch to it after it has finished intializing (including priming the pump).  So when we switch between the old and new worker it should be unoticeable to the user.

Had to move around a lot of code in ScopeManager - there are not a lot of actual changes, but the diff is messy due to this.
@eztierney
Copy link
Contributor Author

@dloverin sorry about the messy diff - it is mostly code moving around - I will go through and try to highlight my actual changes.

numInitialFiles = 0,
numResolvedFiles = 0,
numAddedFiles = 0,
stopAddingFiles = false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of the changes in this file are moving everything to a TernWorker object - namely all the promises around adding files, priming the pump, etc. By having those live in 1 Object, we can just create and init a new one when we want to kill the worker and start a new one.

@eztierney
Copy link
Contributor Author

This should address the crashing seen in Issue #3977. We should reset the worker before we run out of memory now.

@ghost ghost assigned dloverin May 29, 2013
@dloverin
Copy link

Looks good, just one nit.

@petetronic
Copy link
Contributor

I'm guessing if we get partial text updates working for Tern queries we can increase the max hints to a higher number?

@eztierney
Copy link
Contributor Author

@pfarland yes - once we have file fragments we should be able to raise the limit a lot higher based on what we've seen in the tern demo.

dloverin pushed a commit that referenced this pull request May 30, 2013
[js code hints] Kill and restart the codehint worker thread every 30 hint requests.
@dloverin dloverin merged commit 09df6c2 into adobe:master May 30, 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