Android Fatal signal 11 SIGSEGV at 0x636f7d89 code1. How can it be tracked down?
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.
The Android fatal signal 11, also known as SIGSEGV, is a segmentation fault that often indicates an invalid memory access. It is a common error found in Android development, especially when native code (such as C or C++ via the Android NDK) is involved. Here's a detailed explanation of what it is and how to track it down.
Understanding Signal 11 (SIGSEGV)
In Unix-like operating systems, a `SIGSEGV` signal is sent to a process when it makes an invalid memory access – in other words, when it tries to read or write to a memory address that it is not permitted to access. Signal 11 errors often occur due to:
- Dereferencing null or invalid pointers.
- Buffer overflows.
- Incorrect use of pointers that have been freed.
In Android, this can occur in native libraries or any code running through the Android NDK, leading to a crash of the application.
Common Causes
- Pointer Errors: Common in C/C++, when pointers reference invalid memory locations.
- Memory Leak: Failing to free up memory can exhaust available memory, leading to segmentation faults.
- Array Index Out-of-Bounds: Trying to access elements beyond the limits of an array.
- Multi-threading Issues: Race conditions and improper use of shared resources.
Tracking Down the Source
1. Log Analysis
When an application crashes due to a `SIGSEGV`, Android's log (Logcat) provides useful information. For instance:
- Fault Address: `0x636f7d89` is the address that caused the fault. This can be used to trace back to the specific piece of code causing the error.
- Code 1 (SEGV_MAPERR): Indicates an address that does not map to any valid location in the application's address space.
- Breakpoints and Watches: Set breakpoints in likely trouble spots to step through code execution.
- Disassembly View: View assembly code to see exactly where the fault happened.
- clang-tidy and cppcheck: Can highlight potential pointer misuse or invalid accesses.
- SonarQube: Analyzes code quality and points out issues.
- Smart Pointers: In C++, using smart pointers like `std::shared_ptr` and `std::unique_ptr` helps manage memory more effectively.
- RAII (Resource Acquisition Is Initialization): This paradigm ensures resource management is tied to object lifetime.
Related reading
- Android how many threads can I have going?
- Android Preventing Double Click On A Button
- Android splash screen image sizes to fit all devices
- Android Studio Google JAR file causing GC overhead limit exceeded error
- Android Force EditText to remove focus?
- Android. Fragment getActivity sometimes returns null
- Android Fragment no view found for ID?
- Android Google maps java.lang.NoClassDefFoundError Failed resolution of Lorg/apache/http/ProtocolVersion

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.