question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

See original GitHub issue

I am struggling with the React Native and aws-sdk. The reason I use aws-sdk instead of aws-amplify is because:

aws-amplify does not support Using a pre-signed URL to upload a file

My project is working fine until aws-sdk is installed by npm and aws-sdk-react-native is imported (this file is 4.3MB when aws-sdk version is “2.369.0”).

After adding this line of code:

const AWS = require("aws-sdk/dist/aws-sdk-react-native");

The application crashes with the error message:

transform[stdout]: <--- Last few GCs --->
transform[stdout]:
transform[stdout]: [5433:0x103800000]    59176 ms: Mark-sweep 1256.2 (1442.0) -> 1236.2 (1434.5) MB, 3855.9 / 0.0 ms  (average mu = 0.239, current mu = 0.130) allocation failure scavenge might not succeed
transform[stdout]: [5433:0x103800000]    63390 ms: Mark-sweep 1259.8 (1442.5) -> 1243.1 (1438.5) MB, 3924.9 / 0.0 ms  (average mu = 0.161, current mu = 0.069) allocation failure scavenge might not succeed
transform[stdout]:
transform[stdout]:
transform[stdout]: <--- JS stacktrace --->
transform[stdout]:
transform[stdout]: ==== JS stack trace =========================================
transform[stdout]:
transform[stdout]:     0: ExitFrame [pc: 0x1e49a5a5be3d]
transform[stdout]: Security context: 0x21d5cac9e6e1 <JSObject>
transform[stdout]:     1: queue [0x21d5c3f5fc09] [/Users/yumac/Projects/ReactNative/Demo/OutOfMemory/node_modules/@babel/generator/lib/buffer.js:~88] [pc=0x1e49a5f9825e](this=0x21d55e682309 <Buffer map = 0x21d51ca6ba29>,str=0x21d577355491 <String[12]:             >)
transform[stdout]:     2: StringLiteral [0x21d5c3f07491] [/Users/yumac/Projects/ReactNative/Demo/OutOfMemory/node_modules/@babel/ge...
transform[stdout]:
transform[stderr]: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
transform[stderr]:  1: 0x10003ae75 node::Abort() [/usr/local/bin/node]
transform[stderr]:  2: 0x10003b07f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
transform[stderr]:  3: 0x1001a7ae5 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
transform[stderr]:  4: 0x100572ef2 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
transform[stderr]:  5: 0x1005759c5 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
transform[stderr]:  6: 0x10057186f v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
transform[stderr]:  7: 0x10056fa44 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
transform[stderr]:  8: 0x10057c2dc v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
transform[stderr]:  9: 0x10057c35f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
transform[stderr]: 10: 0x10054bca4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
transform[stderr]: 11: 0x1007d3b54 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
transform[stderr]: 12: 0x1e49a5a5be3d
transform[stderr]: 13: 0x1e49a5f9825e
transform[stderr]: 14: 0x1e49a5f84e0f
transform[stderr]: 15: 0x1e49a5a0a5c3
transform[stderr]: 16: 0x1e49a5ee8a79 

I try a lot of solution like:

increase-memory-limit

node --max-old-space-size=8192 index.js

If you tried these solution and it is work, please let me know. Maybe I did something wrong

If you have any suggestion, I am always willing to hear from you.

Thank you in advance!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

6reactions
cglacetcommented, Mar 31, 2019

What the heck, I have a similar problem but I don’t understand why would this program need 8GB of ram to process a 4MB file?

4reactions
LuongTruongcommented, Jan 26, 2019

Hi @nurely , sorry for replying you late. I have post the solution on this page

React-native max_old_space_size

Read more comments on GitHub >

github_iconTop Results From Across the Web

FATAL ERROR: Ineffective mark-compacts near heap limit ...
The error occurs when you exceed the default maximum memory allowed for Node.js. All this does is increase the maximum memory allowed.
Read more >
JavaScript heap out of memory - Snyk Support
You may encounter an error such as the following while running one of the Snyk CLI commands: FATAL ERROR: Ineffective mark-compacts near heap...
Read more >
How to solve JavaScript heap out of memory error
FATAL ERROR : Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory. Both errors above occur when ...
Read more >
FATAL ERROR: Ineffective mark-compacts near ... - YouTube
Next. js optimized production build Error. FATAL ERROR : Ineffective mark - compacts near heap limit Allocation failed - JavaScript heap out of ......
Read more >
Ineffective mark-compacts near heap limit Allocation failed ...
I try to build onnxruntime for web. I'm stuck on Heap Memory problem. Env: Node: 16.15.1 Python: 3.10.5 RAM: 16GB.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found