Kernel and segmentation error

I want to know the exact difference between segmentation fault and kernel dump. I agree that they are operating system dependent and of course arise from improper memory management. But please, come up with some general approaches that need to be followed to prevent them?

Sachin Chourasiya

+2


source to share


2 answers


The main file is a memory image of the crashed process. Using the debugger, you can find out the possible reasons for the failure. If you don't know what to do with the main file (other than rm core

), you can ask not to create them with limit coredumpsize 0

.

Segmentation fault is one manifestation of process failure. This usually occurs when a program is trying to access memory that it shouldn't.

There are several reasons for segmentation. here is a partial list:



  • accessing data through an uninitialized pointer
  • access to malloc'ed memory that was free
  • accessing array elements outside the array size
  • ...

There are tools for detecting such poor memory access. purify or lint are examples of this.

+4


source


A segmentation error is the result of an invalid memory access and causes SIGINT signal, which typically causes the completion of the application.



A core dump is a file that is usually written when an application crashes after, for example, a segmentation fault that a developer can analyze the state of the application during the crash.

+3


source







All Articles