When I use apt-get to install or upgrade my Ubuntu hardy system, I often get messages like this:
$ sudo apt-get install foo
Reading package lists... Done
Segmentation faulty tree... 50%
$ sudo apt-get install foo
Reading package lists... Done
Building dependency tree
Reading state information... Done
Segmentation fault
$ sudo apt-get install foo
Reading package lists... Done
Building dependency tree
Reading state information... Done
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Aborted
cc -Os -g -Wall -DLOCAL_ROOT=\"/usr/share/polipo/www/\" -DDISK_CACHE_ROOT=\"/var/cache/polipo/\" -DCHUNK_SIZE=16384 -c -o http_parse.o http_parse.c
http_parse.c:1564: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.2/README.Bugs>.
make: *** [http_parse.o] Error 1
It doesn't happen all the time, so if you retry enough you can usually get things done, but it does segfault an annoying large percentage of the time.
Any idea what's going on or how to fix it?
A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core . Segfaults are caused by a program trying to read or write an illegal memory location.
Core Dump/Segmentation fault is a specific kind of error caused by accessing memory that “does not belong to you.” When a piece of code tries to do read and write operation in a read only location in memory or freed block of memory, it is known as core dump. It is an error indicating memory corruption.
See if your compiler or library can be set to check bounds on [i] , at least in debug mode. Segmentation faults can be caused by buffer overruns that write garbage over perfectly good pointers. Doing those things will considerably reduce the likelihood of segmentation faults and other memory problems.
Chances are your system is running out of memory when trying to execute your code, which results in a segmentation fault. This is still valid after 7 years.
If standard tools are intermittently failing, particularly with memory errors like that, it's time to suspect the hardware.
Run memtest (from the grub menu is best), and leave it to run for several cycles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With