0

I am having the compilation error on compiling the following library in react

"@emurgo/cardano-serialization-lib-asmjs": "^10.0.0"

I am importing this library like this:

import { Value } from '@emurgo/cardano-serialization-lib-asmjs'

and getting the following error on npm start:

<--- Last few GCs --->

[17762:0x128008000]    27872 ms: Scavenge 2042.7 (2086.0) -> 2041.8 (2090.0) MB, 3.3 / 0.0 ms  (average mu = 0.232, current mu = 0.011) allocation failure 
[17762:0x128008000]    29876 ms: Mark-sweep (reduce) 2044.7 (2090.0) -> 2043.7 (2085.7) MB, 1301.1 / 0.1 ms  (+ 183.0 ms in 45 steps since start of marking, biggest step 9.8 ms, walltime since start of marking 1515 ms) (average mu = 0.247, current mu = 0.

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x1010582dc node::Abort() [/Users/hamzaaamir/.nvm/versions/node/v16.15.1/bin/node]
 2: 0x101058464 node::errors::TryCatchScope::~TryCatchScope() [/Users/hamzaaamir/.nvm/versions/node/v16.15.1/bin/node]
 3: 0x1011a7b90 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/hamzaaamir/.nvm/versions/node/v16.15.1/bin/node]
 4: 0x1011a7b24 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/hamzaaamir/.nvm/versions/node/v16.15.1/bin/node]
 5: 0x10132b23c v8::internal::Heap::GarbageCollectionReasonToString(v8::internal::GarbageCollectionReason) [/Users/hamzaaamir/.nvm/versions/node/v16.15.1/bin/node]
 6: 0x101329d5c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/hamzaaamir/.nvm/versions/node/v16.15.1/bin/node]

I have tried using the version 9 and 10 also but getting the same error. It would be great if anyone can help me resolving this.

Thanks.

Hamza Awan
  • 122
  • 9

2 Answers2

2

I solved it by increasing heap size on starting the server with this command --max-old-space-size=1500 start

Hamza Awan
  • 122
  • 9
1

In my case version 10.2.0 works.

I first installed the lastest version and got a similar stack trace like yours. After that I tried different versions and 10.2.0 seems to run without this "heap limit Allocation failed" error.

npm rm @emurgo/cardano-serialization-lib-asmjs
npm i @emurgo/cardano-serialization-lib-asmjs@10.2.0
Fabian
  • 3,139
  • 2
  • 23
  • 49
  • 1
    Thanks for the help but i solved it through increasing heap size on starting server with this command `--max-old-space-size=1500 start` – Hamza Awan Sep 07 '22 at 06:20