Allocation failed - JavaScript heap out of memory
See original GitHub issueReproduce
svg-term --cast 47HiIPl0HQxrJ0R0vR9qpxzS4 --window --out animating-my-name.svg
Description
After running this command, my computer was noticeably slow, my mouse was not reponding sometimes. I quickly tried to run htop
command in Linux:
After waiting a while, Nodejs logged these lines:
<--- Last few GCs --->
[313356:0x513b270] 89040 ms: Scavenge 1892.2 (2064.9) -> 1879.9 (2064.9) MB, 6.7 / 0.0 ms (average mu = 0.255, current mu = 0.145) allocation failure
[313356:0x513b270] 89205 ms: Scavenge 1896.4 (2064.9) -> 1886.5 (2067.6) MB, 24.6 / 0.0 ms (average mu = 0.255, current mu = 0.145) allocation failure
[313356:0x513b270] 90199 ms: Mark-sweep 1904.1 (2067.6) -> 1880.2 (2068.9) MB, 878.9 / 0.0 ms (average mu = 0.299, current mu = 0.342) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xa04200 node::Abort() [svg-term]
2: 0x94e4e9 node::FatalError(char const*, char const*) [svg-term]
3: 0xb7978e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [svg-term]
4: 0xb79b07 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [svg-term]
5: 0xd34395 [svg-term]
6: 0xd34f1f [svg-term]
7: 0xd42fab v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [svg-term]
8: 0xd46b6c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [svg-term]
9: 0xd1524b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [svg-term]
10: 0x105b23f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [svg-term]
11: 0x1401219 [svg-term]
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6
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 >Node.js heap out of memory
I have a 64-bit CPU and I've installed x86 node version, which caused the CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory ......
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 >JavaScript Heap Out Of Memory Error
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 >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
We tried converting a 1:30 asciinema with SVG term giving more than 4gb of ram available. It just killed the machine up to no responsiveness and needed reset. In the meanwhile, https://github.com/nbedos/termtosvg just rendered the asciicast in under 5 sec flawlessly with under 200mb of ram.
The difference is so huge and the answer was so out of the scope that I first thought your answer was a joke. Definitely thought it was when I read the last sentence.
If it was not, then sorry, I never meant to talk about optimization seriously on a node-js software.
@MuhammadSawalhy Just ran into this. It turns out the Node runtime is running out of memory (I think the default is 500mb or something). Depending on how much memory you have on your machine, you can increase this by setting environment variables. For a 4GB heap you can do this for example:
I can see that you were already close to the limit of your mem utilisation. The next time you run a conversion you may want to close all other windows and increase the size of your swap.
Good luck.