Differences between version 5 and revision by previous author of CommonProgrammingBugs.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 5 | Last edited on Saturday, August 23, 2003 6:03:58 pm | by StuartYeates | Revert |
Older page: | version 4 | Last edited on Saturday, August 23, 2003 5:46:12 pm | by SamJansen | Revert |
@@ -1,11 +1,11 @@
!!!My program causes a "[Segmentation Fault|SIGSEGV]" in malloc(3) or new
It's common for a program to cause a "Segmentation Fault" in new or malloc(3) if you have previously corrupted memory by using a pointer incorrectly.
-To diagnose this problem, compile everything with "-g" (and probably "-Wall" as well) and link it all with electric fence ("-lefence").
+To diagnose this problem, compile everything with "-g" (and probably "[
-Wall]
" as well) and link it all with electric fence ("-lefence").
eg:
- gcc -g -Wall broken.cc -o broken.o
+ [
gcc|gcc(1)]
-g [
-Wall]
broken.cc -o broken.o
gcc -lefence broken.o -o broken
Check your ulimit(1) is not set to 0 (as is the default on most recent distros).
ulimit -c unlimited