alexcanessa / typescript-coverage-report

Node command tool to generate TypeScript coverage report
MIT License
489 stars 31 forks source link

Bug: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory #136

Closed RebeccaStevens closed 1 year ago

RebeccaStevens commented 1 year ago

Describe the bug Just tried this out for the first type on one of my projects but it errors with:

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

To Reproduce Try adding this to https://github.com/RebeccaStevens/uom-types (v2)

Expected behaviour It not to crash.

Environment

Additional context

> typescript-coverage-report

<--- Last few GCs --->

[4392:0x6df7950]    26929 ms: Scavenge 4041.9 (4114.3) -> 4041.5 (4125.6) MB, 9.0 / 0.0 ms  (average mu = 0.362, current mu = 0.215) allocation failure; 
[4392:0x6df7950]    27012 ms: Scavenge 4050.8 (4127.3) -> 4050.1 (4129.1) MB, 8.9 / 0.0 ms  (average mu = 0.362, current mu = 0.215) allocation failure; 
[4392:0x6df7950]    27693 ms: Scavenge 4052.4 (4129.1) -> 4051.5 (4150.6) MB, 668.7 / 0.0 ms  (average mu = 0.362, current mu = 0.215) allocation failure; 

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb7b3e0 node::Abort() [node]
 2: 0xa8c8aa  [node]
 3: 0xd69100 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xd694a7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xf46ba5  [node]
 6: 0xf5908d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 7: 0xf3378e v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0xf34b57 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 9: 0xf15d2a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
10: 0x12dacdf v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x1707b79  [node]
Aborted
alexcanessa commented 1 year ago

Thanks for raising this @RebeccaStevens. Are you able to just add type-coverage and run it in isolation to see if that's also giving you the same issue?

RebeccaStevens commented 1 year ago

After much further work on my library, I can no use this tool without error. I believe the cause of this error was due to using very large conditional types.