Heap limit Allocation failed/JavascriptHeap out of memory
See original GitHub issueWhen using hardhat to compile contracts/generate typescript, after the compilation finishes successfully typechain hangs for several seconds before running out of memory.
The most recent addition to the code were some nested Structs (no more than 2 levels), though I’ve never run into any issues like this before, and definitely no recursive structs.
reinstalling (purging node_modules) did not change the result.
Compilation finished successfully
Creating Typechain artifacts in directory typechain for target ethers-v5
<--- Last few GCs --->
[3314:0x7fe0d0008000] 43338 ms: Mark-sweep 4056.1 (4134.2) -> 4052.1 (4134.2) MB, 3081.8 / 0.0 ms (average mu = 0.184, current mu = 0.041) allocation failure scavenge might not succeed
[3314:0x7fe0d0008000] 47172 ms: Mark-sweep 4068.0 (4134.4) -> 4063.9 (4159.1) MB, 3795.3 / 0.0 ms (average mu = 0.092, current mu = 0.010) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0x1100c4515 node::Abort() (.cold.1) [/usr/local/bin/node]
2: 0x10edc5989 node::Abort() [/usr/local/bin/node]
3: 0x10edc5aff node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
4: 0x10ef452c7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x10ef45263 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
6: 0x10f0e6975 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
7: 0x10f0e52fc v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
8: 0x10f0f1af0 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
9: 0x10f0f1b71 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x10f0becc7 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
11: 0x10f47449e v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x10f81ddd9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
error Command failed with signal "SIGABRT".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to Fix JavaScript Heap Out of Memory Error
A common problem while working on a JavaScript Node.js project is the “JavaScript heap out of memory” error. This error usually occurs when ......
Read more >JavaScript heap out of memory
This generally occurs on larger projects where the default amount of memory allocated by Node (1.5gb) is insufficient to complete the command successfully....
Read more >How to solve JavaScript heap out of memory error
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. ... Alternatively, you ......
Read more >Node.js heap out of memory - javascript
If I remember correctly, there is a strict standard limit for the memory usage in V8 of around 1.7 GB, if you do...
Read more >JavaScript Heap Out Of Memory Error
How to solve the “Heap out of memory” error in JavaScript ... 4096 translates to 4 GB of memory. You can set the...
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
@DominicRomanowski thank you! This is a great repro. It will be fixed this week 😃
Heya, I was able to isolate the issue; Removing the size limit (65535) on the array allowed the typechain to compile