malloc引起的core dump原因

转载自:https://groups.google.com/forum/#!topic/comp.unix.solaris/dPBKDdRDZ1M
常见的情况:

  • 内存越界访问
  • 重复释放同一块内存
  • 重复分配同一块内存
  • 使用被释放掉的内存

The top causes for this:

  1. Writing outside the limits of an allocated block. (Failing to provide space for the trailing null in a string or using calculated subscripts).
  2. free()ing the same block more than once.
  3. Failing to check the return value from realloc() to see if the data was actually reallocated.
  4. Attempting to free() using a pointer that was not provided by malloc().
  5. Using a free()ed data area.

你可能感兴趣的:(malloc引起的core dump原因)