GDB gives me the above error WRT my C++ program. Nowhere I have used any memory function including new and delete etc.
I want to understand the 'MEANING' of this error.
If run your program under gdb, you should be able to print out the backtrace and see what part of your code is causing the segmentation fault. memmove() may being called indirectly through a different system call.
It is possible that an array operation in your code gets optimized as a call to memmove
: this is probably why the compiled code uses memmove
, whereas your source code doesn't.
I think you should check that you are not accessing your arrays out of bounds.
memmove
tried to access (read or write) a memory segment it shouldn't touch.
The reasons can be manifold, but probably pointer corruption. Check it with a debugger, valgrind, check stack trace, etc...
精彩评论