Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
LuongTruong opened this issue Dec 4, 2018 · 9 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@LuongTruong
Copy link

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!

@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. 📋No Template labels Dec 4, 2018
@noor-jafri
Copy link

noor-jafri commented Jan 14, 2019

@truongluong1314520 How did you solve this thing?? :/ This seems like a general error of some kind.

@LuongTruong
Copy link
Author

LuongTruong commented Jan 25, 2019

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

React-native max_old_space_size

@cglacet
Copy link

cglacet commented 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?

@timkuilman
Copy link

Same issue but only after upgrading to the latest RN version and only when archieving my app.

@mikeRChambers610
Copy link

^^ Me too. Going from SDK 27 to 33... Of course it cant be smooth.

@starfall-9000
Copy link

starfall-9000 commented Jul 1, 2019

for anyone bundle images in terminal by using react-native bundle command

node --expose-gc --max_old_space_size=8192 ./node_modules/react-native/local-cli/cli.js bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'

@aashu700
Copy link

Thank you for the solution. I tried the solution and that worked but now I am again facing this with creating debug build.
@truongluong1314520

Configure project :react-native-fetch-blob
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Configure project :react-native-splash-screen
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Task :app:bundleDebugJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
transform[stderr]: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
transform[stderr]: 1: 00007FF62C36EEE5
transform[stderr]: 2: 00007FF62C348CD6
transform[stderr]: 3: 00007FF62C3496E0
transform[stderr]: 4: 00007FF62C7B0D3E
transform[stderr]: 5: 00007FF62C7B0C6F
transform[stderr]: 6: 00007FF62C6FC594
transform[stderr]: 7: 00007FF62C6F2B67
transform[stderr]: 8: 00007FF62C6F10DC
transform[stderr]: 9: 00007FF62C6FA0B7
transform[stderr]: 10: 00007FF62C6FA136
transform[stderr]: 11: 00007FF62C81F7B7
transform[stderr]: 12: 00007FF62C8F87FA
transform[stderr]: 13: 0000007C3E35C6C1
<=======------> 56% EXECUTING [4m 3s]
IDLE
:app:bundleDebugJsAndAssets
IDLE
IDLE

@LuongTruong
Copy link
Author

Hi @aashu700 , sorry for the late reply. As far as I know, for debug, instead of using the started Nodejs server, you should shut it down and start a new one by using this command:

node --max-old-space-size=8192 node_modules/react-native/local-cli/cli.js start

You can change the number "8192" to the higher number, but make sure you have enough RAM. Hope it can help

@facebook facebook locked as resolved and limited conversation to collaborators Dec 4, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants