ineffective mark-compacts near heap limit allocation failed - javascript heap out of memory react native

Hey Friends. I am just stuck with a problem. Looking for your help. Basically whenever I try to Publish app or working on the app I suddenly start getting this error “ineffective mark-compacts near heap limit allocation failed - javascript heap out of memory react native”.

I am on Windows 7 with 12GB RAM. Not sure how to increase Heap Memory? I tried this in my package.json but still same problem. Looking for your help. Thank you

{
  "name": "empty-project-template",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "node --max_old_space_size=8192 && expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "react-devtools": "react-devtools"
  },
  "dependencies": {
    "@ptomasroos/react-native-multi-slider": "^1.0.0",
    "accordion-collapse-react-native": "^0.1.6",
    "currency-formatter": "^1.5.3",
    "expo": "^32.0.0",
    "lodash": "^4.17.11",
    "moment": "^2.23.0",
    "native-base": "^2.8.1",
    "prop-type": "^0.0.1",
    "prop-types": "^15.6.2",
    "react": "16.3.1",
    "react-devtools": "^3.4.2",
    "react-image-picker": "^1.1.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
    "react-native-checkbox-group": "^1.0.3",
    "react-native-country-picker-modal": "^0.6.2",
    "react-native-elements": "^0.19.1",
    "react-native-flexi-radio-button": "^0.2.2",
    "react-native-htmlview": "^0.13.0",
    "react-native-masked-text": "^1.12.2",
    "react-native-modal": "^6.5.0",
    "react-native-multi-select": "^0.1.1",
    "react-native-phone-input": "^0.2.1",
    "react-native-popover-view": "^1.0.9",
    "react-native-progress-circle": "^2.0.1",
    "react-native-search-header": "^0.3.1",
    "react-native-searchable-dropdown": "^1.0.6",
    "react-native-sectioned-multi-select": "^0.6.5",
    "react-native-select-multiple": "^1.2.0",
    "react-native-share": "^1.1.3",
    "react-native-simple-radio-button": "^2.7.3",
    "react-native-swiper": "^1.5.14",
    "react-native-tag-autocomplete": "^1.0.21",
    "react-native-vector-icons": "^6.1.0",
    "react-navigation": "^2.18.1",
    "react-navigation-transitions": "^1.0.10",
    "react-redux": "^5.0.7",
    "redux-promise-middleware": "^5.1.1",
    "redux-saga": "^0.16.2",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "schedule": "^0.4.0"
  }
}

Hey @shubham_agarwal,

This may be the result of one of your third-party dependencies having a very large .js file. Do any of these libraries jump out to you that could be the culprit?

Cheers,
Adam

Hi Adam,

Thanks for taking time to respond on my query.

I just checked but there is not any large library. In fact the overall size of my project is less than 200MB. Do you think that I have correctly increased the Node memory from my package json file? Is there something else I could do?

I have seen multiple articles talking about using Node Options “node --max_old_space_size=8192” but I am just confused how to use it in my project and effectively increase Node memory.

Hey @shubham_agarwal,

It looks like you’re using the flag correctly here. A quick google search shows that this library may be another thing to try.

Cheers,
Adam

Hello @adamjnav ,
I am facing the same problem & project crashes almost every 5 minutes. I have tried all the solutions mentioned in this thread, but nothing seems to work.

Hey @garimap,

Can you share your environment via expo diagnostics and your package.json contents?

Thanks,
Adam

Expo CLI 2.19.4 environment info:
System:
OS: macOS High Sierra 10.13.6
Shell: 3.2.57 - /bin/sh
Binaries:
Node: 10.13.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
IDEs:
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmGlobalPackages:
expo-cli: 2.4.0

package.json:

{
“name”: “”,
“version”: “0.1.0”,
“private”: true,
“devDependencies”: {
“babel-eslint”: “^8.2.5”,
“babel-jest”: “21.2.0”,
“babel-preset-react-native”: “4.0.0”,
“eslint”: “^4.19.1”,
“eslint-config-airbnb”: “^16.1.0”,
“eslint-plugin-import”: “^2.13.0”,
“eslint-plugin-jsx-a11y”: “^6.1.0”,
“eslint-plugin-react”: “^7.10.0”,
“eslint-plugin-react-hooks”: “^1.6.0”,
“jest”: “^21.2.1”,
“jest-expo”: “^33.0.0”,
“react-native-scripts”: “1.14.0”,
“react-test-renderer”: “16.3.1”,
“redux-mock-store”: “^1.3.0”,
“remote-redux-devtools”: “^0.5.16”
},
“main”: “node_modules/expo/AppEntry.js”,
“scripts”: {
“start”: “node --max_old_space_size=8192 && expo start”,
“eject”: “expo eject”,
“android”: “expo start --android”,
“ios”: “expo start --ios”,
“test”: “jest”,
“eslint”: “eslint”,
“devtools”: “react-devtools”
},
“jest”: {
“preset”: “jest-expo”,
“modulePathIgnorePatterns”: [
“/node_modules/”
],
“watchPathIgnorePatterns”: [
“/node_modules/”
]
},
“dependencies”: {
@expo/react-native-read-more-text”: “^1.1.0”,
@proworkdev/react-custom-date-picker”: “0.0.13”,
@ptomasroos/react-native-multi-slider”: “^1.0.0”,
“axios”: “^0.18.0”,
“babel-plugin-transform-remove-console”: “^6.9.4”,
“entities”: “^1.1.1”,
“expo”: “^33.0.0”,
“expo-asset”: “^5.0.1”,
“expo-asset-utils”: “0.0.5”,
“expo-av”: “~5.0.2”,
“expo-background-fetch”: “~5.0.1”,
“expo-cli”: “^2.18.7”,
“expo-constants”: “~5.0.1”,
“expo-file-system”: “~5.0.1”,
“expo-location”: “~5.0.1”,
“expo-permissions”: “~5.0.1”,
“expo-react-native-adapter”: “^3.0.1”,
“expo-sqlite”: “~5.0.1”,
“expo-task-manager”: “~5.0.1”,
“firebase”: “^5.9.0”,
“global”: “^4.3.2”,
“lottie-react-native”: “~2.6.1”,
“md5”: “^2.2.1”,
“native-base”: “^2.5.1”,
“prop-types”: “^15.6.0”,
“react”: “16.8.3”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz”,
“react-native-awesome-alerts”: “^1.1.1”,
“react-native-drawer”: “^2.5.1”,
“react-native-gifted-chat”: “^0.7.2”,
“react-native-modal”: “^6.5.0”,
“react-native-permissions”: “^1.1.1”,
“react-native-reanimated”: “^1.0.0-alpha.12”,
“react-native-safe-area”: “^0.4.4”,
“react-native-safe-area-view”: “^0.9.0”,
“react-native-simple-twitter”: “^2.0.2”,
“react-native-snap-carousel”: “^3.7.2”,
“react-native-star-rating”: “^1.0.9”,
“react-native-svg-image”: “^2.0.1”,
“react-native-tab-view”: “^1.0.2”,
“react-native-vector-icons”: “^4.6.0”,
“react-navigation”: “^2.13.0”,
“react-navigation-tabs”: “^0.8.2”,
“react-redux”: “^7.1.0”,
“react-timer-mixin”: “^0.13.4”,
“redux”: “^3.7.2”,
“redux-logger”: “^3.0.6”,
“redux-observable”: “^0.16.0”,
“request”: “^2.88.0”,
“reselect”: “^4.0.0”,
“rn-sliding-up-panel”: “^2.3.0”,
“rxjs”: “^5.5.0”,
“sentry-expo”: “~1.11.2”,
“tinycolor2”: “^1.4.1”,
“underscore”: “^1.9.1”,
“validator”: “^10.10.0”
}
}

Still facing the problem, can anyone please guide me on this?

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.