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

JS heap out of memory when using gulp serve #45

Closed
doxxx opened this issue Oct 16, 2018 · 5 comments
Closed

JS heap out of memory when using gulp serve #45

doxxx opened this issue Oct 16, 2018 · 5 comments

Comments

@doxxx
Copy link

doxxx commented Oct 16, 2018

When using gulp serve --debug, after some number of rebuilds due to file changes, the gulp process will crash with an out of memory error. I haven't counted how many rebuilds it takes but it's probably at least 10 or so. The callstack varies a lot.

[10:29:04] Starting 'build'...
[10:29:04] Starting 'webpack'...

<--- Last few GCs --->

[130836:0000014A8A32CAA0]  4931482 ms: Mark-sweep 1384.4 (1456.8) -> 1384.4 (1457.3) MB, 1609.0 / 0.0 ms  allocation failure GC in old space requested
[130836:0000014A8A32CAA0]  4933019 ms: Mark-sweep 1384.4 (1457.3) -> 1384.3 (1424.8) MB, 1536.5 / 0.0 ms  last resort GC in old space requested
[130836:0000014A8A32CAA0]  4934138 ms: Mark-sweep 1384.3 (1424.8) -> 1384.3 (1424.8) MB, 1119.6 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0000037620EA5879 <JSObject>
    1: stringSlice(aka stringSlice) [buffer.js:560] [bytecode=0000018DF7D6C789 offset=94](this=0000016BD6B822D1 <undefined>,buf=0000025C47B176F9 <Uint8Array map = 0000001B8C0C3A71>,encoding=0000037620EB5221 <String[4]: utf8>,start=0,end=413676)
    2: toString [buffer.js:633] [bytecode=0000018DF7D6C3D9 offset=145](this=0000025C47B176F9 <Uint8Array map = 0000001B8C0C3A71>,encoding=0000037620EB5...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node_module_register
 2: v8::internal::FatalProcessOutOfMemory
 3: v8::internal::FatalProcessOutOfMemory
 4: v8::internal::Factory::NewRawTwoByteString
 5: v8::internal::Factory::NewStringFromUtf8
 6: v8::String::NewFromUtf8
 7: v8::internal::compiler::Type::Negative31
 8: std::vector<v8::CpuProfileDeoptFrame,std::allocator<v8::CpuProfileDeoptFrame> >::vector<v8::CpuProfileDeoptFrame,std::allocator<v8::CpuProfileDeoptFrame> >
 9: v8::internal::wasm::SignatureMap::Find
10: v8::internal::Builtins::CallableFor
11: v8::internal::Builtins::CallableFor
12: v8::internal::Builtins::CallableFor
13: 000000897FC843C1
@wictorwilen
Copy link
Member

I noticed this as well occasionally, but haven't found a good solution to it. I'll try get a closer look at it or if someone out there has some extra time over, feel free to chime in

@doxxx
Copy link
Author

doxxx commented Oct 16, 2018

I had a quick look at it using the Chrome dev tools to connect to the gulp node process and it looks like it might be a leak in ts-loader. I saw lots of duplicate strings containing what looked like generated Javascript, and the owner stack led back to ts-loader. If I have some more time later I can try digging deeper to determine where specifically this might be happening.

@wictorwilen wictorwilen added this to Backlog in Generator V2 Apr 18, 2019
@StfBauer
Copy link
Contributor

It has nothing to do with a leak in the ts-loader. The issue comes from NodeJS 8 where they introduced really low memory cap 1.4GB per NodeJS process. The only option to get around this limitation is to start gulp server using the following command.

gulp serve --max-old-space-size=8192

This will set the appropriate Node flag to use a max of 8Gb or whatever value you pass in.

Screenshot 2019-06-10 at 11 56 25

Pre-NodeJS 8 a process could use as many memory as they want or request.

@wictorwilen
Copy link
Member

Closing this as resolved both since the build pipeline is rebuilt and the solution provided by @StfBauer above

@latonita
Copy link

I have same behavior on Node 10.15. Adding max space 8192 postpones the problem for some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Generator V2
  
Backlog
Development

No branches or pull requests

4 participants