Ask coding questions

← Back to all posts
NodeJS Error
XCode101

I am getting this really weird error saying:
<--- Last few GCs --->

[312:0x3280e20] 17321 ms: Mark-sweep 257.4 (261.0) -> 257.4 (260.0) MB, 1207.3 / 0.0 ms (average mu = 0.387, current mu = 0.000) last resort GC in old space requested
[312:0x3280e20] 18524 ms: Mark-sweep 257.4 (260.0) -> 257.4 (260.0) MB, 1203.3 / 0.0 ms (average mu = 0.237, current mu = 0.000) last resort GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1ac8498008d1 <JSObject>
1: lex [0x2f4a7fa49669] [pc=0x3c983224442f](this=0x2f4a7fa496a1 <Lexer map = 0x202494424519>,0x3ef3c948f789 <String[#1]: +>)
2: / anonymous / [0x8fc2602c821] [bytecode=0x8fc2602c589 offset=124](this=0x3ef3c94bffd9 <JSGlobal Object>)
3: InternalFrame [pc: 0x1390c9d]
4: EntryFrame ...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: 0xa1a640 node::Abort() [node]
2: 0xa1aa4c node::OnFatalError(char const, char const) [node]
3: 0xb9a68e v8::Utils::ReportOOMFailure(v8::internal::Isolate, char const, bool) [node]
4: 0xb9aa09 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, bool) [node]
5: 0xd57c85 [node]
6: 0xd685d8 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
7: 0xd2fc8e v8::internal::Factory::NewUninitializedFixedArray(int, v8::internal::AllocationType) [node]
8: 0xe9f161 [node]
9: 0xe9f410 [node]
10: 0x1047ddb v8::internal::Runtime_GrowArrayElements(int, unsigned long, v8::internal::Isolate) [node]
11: 0x140de99 [node]
repl process died unexpectedly: signal: aborted (core dumped)

I am confused. Can someone please help me?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
XCode101
Comments
hotnewtop
Coder100

looks like your repl had a memory leak/ran out of memory can you send repl?

XCode101
XCode101

@Coder100 Thanks! I think I fixed the error by using a for loop instead of a while loop.

Coder100

nice
happy coding!

mark as correct answer? @XCode101

XCode101