Support specify --max-old-space-size for started server
See original GitHub issueWhen I use eslint plugin in VSCode to lint a large bunch of files, the eslint server crashes. I try to find some way to add node options like “–max-old-space-size=4096”, “–stack_size=10000” to start eslint server but failed.
crash message
[Info - 5:28:05 PM] ESLint server stopped.
[Info - 5:28:06 PM] ESLint server running in node v10.11.0
[Info - 5:28:06 PM] ESLint server is running.
[Info - 5:28:07 PM] ESLint library loaded from: /Users/dddong/workspace/JS2FuzzIL/node_modules/eslint/lib/api.js
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x10ae379d5 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
2: 0x10ae37b4a node::get_builtin_module(char const*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
3: 0x1077e2c6e v8::internal::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
4: 0x1078a3fc2 v8::internal::Heap::CreateFillerObjectAt(unsigned long, int, v8::internal::ClearRecordedSlots, v8::internal::ClearFreedMemoryMode) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
5: 0x1078a6703 v8::internal::Heap::CreateFillerObjectAt(unsigned long, int, v8::internal::ClearRecordedSlots, v8::internal::ClearFreedMemoryMode) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
6: 0x1078a272c v8::internal::Heap::CreateFillerObjectAt(unsigned long, int, v8::internal::ClearRecordedSlots, v8::internal::ClearFreedMemoryMode) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
7: 0x1078a0561 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
8: 0x1078acc75 v8::internal::Heap::RootIsImmortalImmovable(int) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
9: 0x1078accdf v8::internal::Heap::RootIsImmortalImmovable(int) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x107449a73 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
11: 0x107625f8c v8::internal::RegisterConfiguration::AreAliases(v8::internal::MachineRepresentation, int, v8::internal::MachineRepresentation, int) const [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
12: 0x107a81d8e v8::internal::Parser::BuildIteratorCloseForCompletion(v8::internal::ZoneList<v8::internal::Statement*>*, v8::internal::Variable*, v8::internal::Expression*, v8::internal::IteratorType) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
<--- Last few GCs --->
[51895:0x10c8a7000] 785803 ms: Mark-sweep 2049.1 (2086.5) -> 2048.4 (2087.5) MB, 2049.2 / 0.0 ms (average mu = 0.073, current mu = 0.007) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x107a81d8e]
Security context: 0x039f533676d9 <JSObject>
1: /* anonymous */ [0x39f4467e3e1] [/Users/dddong/workspace/JS2FuzzIL/node_modules/acorn/dist/acorn.js:~4254] [pc=0x25db0d97b8c0](this=0x039f90bd4d69 <Parser map = 0x39fd3860a81>)
2: /* anonymous */ [0x39f4467c2e1] [/Users/dddong/workspace/JS2FuzzIL/node_modules/acorn/dist/acorn.js:~2728] [pc=0x25db0d875615](this=0x039f90bd4d69 <Parser map = 0x39fd3860a...
Eslint version: 1.9.0 Vscode version: 1.37.0-insider
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:27 (7 by maintainers)
Top Results From Across the Web
How do I determine the correct "max-old-space-size" for node ...
This error occurs when the memory allocated for the executing application is less than the required memory. By default, the memory limit in...
Read more >How Can I Increase the Max Memory for Node?
It's possible to adjust the max memory ceiling using a command-line flag passed into Node: --max-old-space-size=<memory in MB> ...
Read more >Node.js Default Memory Settings | by Hon Nam | Geek Culture
If you are running a simple web server using Node.js on a small machine e.g. Raspberry Pi board, you can set the --max-old-space-size...
Read more >node_options=--max_old_space_size=16384 - You.com
The NODE_OPTIONS --max-old-space-size environment variable allows to increase Node's max heap size. Setting an environmental variable allows Node to read ...
Read more >JavaScript heap out of memory - how to increase the max ...
If you want to increase the max memory for Node you can use --max_old_space_size option. You should set this with NODE_OPTIONS environment variable....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve ended up using the
eslint.runtime
option for this, with the script:@bradleyayers @singleghost Can you please add some more details? I think I’m doing something wrong. Currently, I have this in my
settings.json
:"eslint.runtime": "./vscode-eslint.sh",
andvscode-eslint.sh
contains the code you suggested. Getting the following error:Using absolute path for the bash script seemed to work, after
chmod
.