milesj/docusaurus-plugin-typedoc-api

JavaScript heap out of memory

sedghi opened this issue · 1 comments

As we are getting closer to release, our API documentation is getting much bigger :) but recently I'm facing problems in the build regarding memory issues. I put the logs below. I can do cross-env NODE_OPTIONS=--max_old_space_size=10240 docusaurus build locally and it is fine, but netlify doesn't allow more than 6GB and fails miserably. I was wondering if you know such memory problems either in this plugin, or typedoc or in docusaurus.

$ docusaurus build
[INFO] [en] Creating an optimized production build...
Debug: Using TypeScript 4.5.5 from /Users/username/dev/myRepository/myRepository.git/docs/docs-remaining/node_modules/typescript/lib
Debug: Converting with 1 programs 3 entry points

<--- Last few GCs --->

[17231:0x1046c6000]   157771 ms: Mark-sweep (reduce) 4088.5 (4100.8) -> 4087.4 (4101.6) MB, 2121.0 / 0.0 ms  (average mu = 0.097, current mu = 0.006) allocation failure scavenge might not succeed
[17231:0x1046c6000]   159689 ms: Mark-sweep (reduce) 4088.4 (4100.8) -> 4087.3 (4101.8) MB, 1910.8 / 0.0 ms  (average mu = 0.053, current mu = 0.004) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x1012e2ba5 node::Abort() (.cold.1) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
 2: 0x1000a5cb9 node::Abort() [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
 3: 0x1000a5e1f node::OnFatalError(char const*, char const*) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
 4: 0x1001e83e7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
 5: 0x1001e8383 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
 6: 0x100397275 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
 7: 0x100398d3a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
 8: 0x100394409 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
 9: 0x100391ca1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
10: 0x1003a053a v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
11: 0x1003a05c1 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
12: 0x10036df67 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
13: 0x1006ecca8 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
14: 0x100a795f9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/username/.nvm/versions/node/v14.15.0/bin/node]
15: 0x36102225ddde 
error Command failed with signal "SIGABRT".

@sedghi It's definitely not this plugin as I simply call out to typescript and typedoc.

I'd suggest trying to build the typedoc docs using typedoc itself and see if that's the problem https://typedoc.org/guides/installation/