signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) libjsc.so still occuring on Caterpillar S41 (Android 8.0)
Problem
Same as https://github.com/facebook/react-native/issues/24261 but still occuring on device Caterpillar S41 (Android 8.0). React Native version: 0.59.10 [code block]
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Upgrade React Native and Adjust Memory Settings
The SIGSEGV error indicates a segmentation fault, often caused by memory access violations. In React Native 0.59.10, there are known memory management issues, particularly on older Android devices like the Caterpillar S41 running Android 8.0. This can occur due to improper handling of native modules or insufficient memory allocation for JavaScript execution.
Awaiting Verification
Be the first to verify this fix
- 1
Upgrade React Native to a stable version
Upgrade your React Native version to at least 0.60 or later, where many memory management issues have been resolved. This can be done by updating the package.json and running npm install.
bashnpm install react-native@0.60.0 - 2
Increase JavaScript heap size
Modify the Android project settings to increase the JavaScript heap size. This can help mitigate memory issues on devices with limited resources. Open the android/app/build.gradle file and add the following line under the 'project.ext.react' section.
yamlproject.ext.react = [enableHermes: false, jsBundleDir: "${projectDir}/../build/jsbundle", jsHeapSize: 512] - 3
Check for native module issues
Review any custom native modules for memory leaks or improper memory handling. Ensure that all native modules are correctly managing their lifecycle and releasing resources when no longer needed.
java// Example of releasing resources in a native module @Override public void onHostDestroy() { // Clean up resources } - 4
Test on a physical device
After making the changes, build and run the application on the Caterpillar S41 device to verify that the SIGSEGV error no longer occurs. Monitor the app's memory usage during operation.
bashreact-native run-android
Validation
To confirm the fix, monitor the application for any SIGSEGV errors during runtime. Additionally, check the memory usage of the app using Android Studio's profiler to ensure it is within acceptable limits.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep