question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JavaScript heap out of memory after upgrading to 4.3

See original GitHub issue

Bug Report

🔎 Search Terms

Memory

🕗 Version & Regression Information

After upgrading to 4.3.2 I get a “JavaScript heap out of memory” exception when i try to run tsc. Downgrading to 4.2.4 does not yield the same error.

<--- Last few GCs --->

[43233:0x108008000]    75872 ms: Scavenge 2043.5 (2049.9) -> 2043.0 (2049.9) MB, 6.6 / 0.0 ms  (average mu = 0.119, current mu = 0.127) allocation failure 
[43233:0x108008000]    75927 ms: Scavenge 2043.8 (2049.9) -> 2043.3 (2050.2) MB, 6.5 / 0.0 ms  (average mu = 0.119, current mu = 0.127) allocation failure 
[43233:0x108008000]    75986 ms: Scavenge 2044.0 (2050.2) -> 2043.5 (2050.4) MB, 7.0 / 0.0 ms  (average mu = 0.119, current mu = 0.127) allocation failure 


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x100930c99]
Security context: 0x390dbb3008a1 <JSObject>
    1: getIntersectionType(aka getIntersectionType) [0x390df5b65bb9] [/.../node_modules/typescript/lib/tsc.js:~47588] [pc=0x1a0124246ed4](this=0x390d982804a9 <undefined>,0x390d7a08df51 <JSArray[18]>,0x390d982804a9 <undefined>,0x390d982804a9 <undefined>)
    2: getCrossProductIntersections(aka getCrossProductIntersections) [0...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10007e9b3 node::Abort() [/usr/local/bin/node]
 2: 0x10007eb37 node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
 3: 0x100176337 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 4: 0x1001762d3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 5: 0x1002fa485 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
 6: 0x1002fbb54 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
 7: 0x1002f8a27 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
 8: 0x1002f6a0d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 9: 0x1002f58c1 v8::internal::Heap::HandleGCRequest() [/usr/local/bin/node]
10: 0x1002bac3f v8::internal::StackGuard::HandleInterrupts() [/usr/local/bin/node]
11: 0x1005f7b6c v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x100930c99 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
13: 0x1a0124246ed4

🙁 Actual behavior

It crashed.

🙂 Expected behavior

No crash

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:33
  • Comments:40 (15 by maintainers)

github_iconTop GitHub Comments

7reactions
brudilcommented, Jun 2, 2021

We’re experiencing this against both our front and backend applications which is interesting as they share little code. By any chance is anyone else here using Zod? It’s perhaps the most type-complex library which we’re using in both.

4reactions
grantilacommented, Jun 22, 2021

I’ve seen this repeatedly too in different project (can’t share the code yet). E.g. usages suretype and meta-types (both of which I’m the author of). (Again, not in these packages per se, but usages of them).

I’ve stumbled on this many times from at least 3.x. I think TypeScript would benefit from a rather massive bump in meta programming support and much higher limits. I remember back when C++ template programming was unbearably slow, and then about 10 years ago, compilers made a huge leap and started handling meta programming several orders of magnitude faster. I’d love for this to get prio over new features in the language 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
This error usually occurs when the default memory allocated by your system to Node. js is not enough to run a large project....
Read more >
JS heap out of memory since migration angular 11 to 12,13 or ...
I had this issue upgrading to Angular 12, the problem is because node-sass is deprecated and instead it is used sass , so...
Read more >
JavaScript Heap Out Of Memory Error - OpenReplay Blog
A quick solution that you can use to fix "Heap Out Of Memory Error" in JavaScript. We lay out the causes and how...
Read more >
fatal error: reached heap limit allocation failed - You.com
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. Here's an example...
Read more >
Upgrading above 4.2.2 gives memory heap errors, latest try ...
When upgrading from 4.2.2, have tried at least 4.3.1 and 4.4.1, it ends up with memory errors, downgrading back to 4.2.2 solves the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found