Segmentation Fault 11 [Meaning, causes & how to fix]

by Milan Stanojevic
Milan Stanojevic
Milan Stanojevic
Windows & Software Expert
Milan has been enthusiastic about PCs ever since his childhood days, and this led him to take interest in all PC-related technologies. Before joining WindowsReport, he worked as... read more
Affiliate Disclosure
  • Programming can be a complicated task, and errors are bound to appear sooner or later.
  • One relatively common error is Segmentation fault 11, and in this article, we’ll show you how to fix this issue.
  • Having additional computer problems? Our Fix section has all the solutions you need.
  • For more programming guides like this one, be sure to check our Debugging Hub.
segmentation fault 11
To fix various PC problems, we recommend DriverFix:
This software will keep your drivers up and running, thus keeping you safe from common computer errors and hardware failure. Check all your drivers now in 3 easy steps:

  1. Download DriverFix (verified download file).
  2. Click Start Scan to find all problematic drivers.
  3. Click Update Drivers to get new versions and avoid system malfunctionings.
  • DriverFix has been downloaded by 0 readers this month.

C is one of the most used programming languages but sometimes while developing new software you might encounter Segmentation fault 11 error.

This error will cause your application to crash, and in today’s article, we’re going to show you what this error means and how to fix it once and for all.

How can I fix Segmentation fault: 11?

What does Segmentation fault 11 mean/ What is Segmentation fault 11 C++?

question mark segmentation fault: 11

When Segmentation fault 11 occurs, it means that a program has attempted to access a memory location that it’s not allowed to access.

The error can also occur if the application tries to access memory in a method that isn’t allowed.

How to debug Segmentation fault 11?

1. Compile the code and use gdb

compile code segmentation fault: 11
  1. Run the following command:
    gcc program.c -g
  2. Now use the gdb like this:

$ gdb ./a.out

(gdb) run

(gdb) backtrace

In addition, users are also recommending to run these two commands:

lldb executable_name

run -flag1 -flag2

2. Inspect your code

inspect code segmentation fault: 11
  1. Double-check your code
  2. Make sure that there aren’t any declarations that might be using too much memory.

This is also a useful tip if you’re getting Segmentation fault: 11 while using Python.

3. Use the malloc command

malloc command segmentation fault: 11
  1. Use the malloc command properly.
  2. Of course, always use the following command to free the memory:


4. Use the char var/int arr command

char var segmentation fault: 11

In your code, use the following command:

char var[strlen(x)+1]

int arr[(sizeof(x)/sizeof(x[0]) +1)]

Use one of these commands depending on your needs.

5. Other general tips

coding tips segmentation fault: 11
  1. Make sure that your global variables have assigned values.
  2. Separate your code into different files for easier debugging.

Segmentation fault 11 Python

1. Uninstall Shapely

uninstall shapely segmentation fault: 11

On your Mac, run the following command:

pip uninstall shapely; pip install --no-binary :all: shapely

Keep in mind that this method might only work if you’re trying to install Cartopy.

2. Use the Terminal

  1. Start the Terminal from the Applications > Utilities directory.
    terminal open segmentation fault: 11
  2. Once the Terminal starts, run the following commands:

cd /Library/Frameworks/Python.framework/Versions/3.3

cd ./lib/python3.3/lib-dynload

sudo mv

Segmentation fault 11 is usually caused by memory allocation issues, and if you’re having this problem, be sure to try some of the solutions mentioned above.

idee restoro Still having issues? Fix them with this tool:
  1. Download this PC Repair Tool rated Great on (download starts on this page).
  2. Click Start Scan to find Windows issues that could be causing PC problems.
  3. Click Repair All to fix issues with Patented Technologies (Exclusive Discount for our readers).

Restoro has been downloaded by 0 readers this month.

This article covers:Topics: