Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching for keywords crashes VS Code #55

Closed
tarekis opened this issue Jul 31, 2017 · 6 comments
Closed

Searching for keywords crashes VS Code #55

tarekis opened this issue Jul 31, 2017 · 6 comments

Comments

@tarekis
Copy link

tarekis commented Jul 31, 2017

Using the search functionality crashes VS Code on my machine.
VS Code Version: 1.14.1
OS Version: Ubunutu 16.04 LTS x64

This might be related to #35, although for me it never completes because of the crash.

Select command:
selection_014
Command executing:
selection_015
VS Code crashes:
selection_016

@jfpoilpret
Copy link

Got the same issue here on Fedora 26 and VS Code 1.15.1.
Exact same symptoms.
I configured "TODO" and "FIXME" as keywords (without the colon).
I also set the include to only .h and .cpp files. My project has less than 200 such source files, and probably less than 30 TODO/FIXME.

Unfortunately that makes this extension just useless to me.

@jfpoilpret
Copy link

Update on my previous comment: after reducing todohighlight.maxFilesForSearch to 512, the extension worked. That is probably related to memory consumption. Does the extension try to allocate memory for 5120 files upfront?

@tarekis
Copy link
Author

tarekis commented Aug 31, 2017

Does look like it, I'm not familiar with how VSCode handles these operations, but I think this loop should be a promise sequence, I think I'll test on that assumption soon.

@tarekis
Copy link
Author

tarekis commented Sep 1, 2017

So i tried this on my local machine, with 200k included files, 10k included files and 500 files, which i believe to be a realistic amount for a small/mid-tier project.

My finding for now is - as i suspected - the syncronous loop over all those found files causes the application to crash. As long the files searched for are in a reasonable amount (10k - wich is probably way over the top - worked all fine, and was done in a couple seconds), the .findFiles doesn't cause any problem. I will fiddle around with it and see where exactly the problem is coming from.

@allenyllee
Copy link

I have the same problem on ubuntu 16.04 and VS Code 1.18.1.

After a little dig into the code, I find a suspicious code here

Actually, there are double for loop: one is loop for totalFiles, the other is loop for file.lineCount. Says, if there are 1000 files with average 1000 lines, the total number of .match operation is 1000,000. This is a O(N^2) time complexity.

But if I use build-in ctrl+shift+F search for TODO, there is no problem. So, maybe one can use the build-in search in file API to replace searchAnnotationInFile function.

@phil294
Copy link
Contributor

phil294 commented Jan 2, 2018

This can also be triggered by various extensions: I had to disable PHP IntelliSense, Angular productivity pack and ESLint. All of these iterate through existing files and seem to interfere the openTextDocument call which is then dramatically slow. Also I am getting multiple node-upload.js:40 Error: EMFILE: too many open files, open '(filename)' errors. There seems to be all sorts of problems and most probably a complete rewrite is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants