1
votes

Is this my bug or a bug/assertion fail in malloc itself?

alloc.c:2451: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size)

= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.

  • libstdc++6:amd64 4.7.2-2ubuntu1
  • gcc 4.7.2
  • ubuntu 12.10/64bit
1
Its very likely to be a bug in your code, caused by a memory obver-write. Can you narrow it down to a small enough code sample to post more info? - simonc
You have corrupted the heap somewhere. malloc() is one of the most used functions in the C library, it's unlikely you've stumbled on a bug. See codinghorror.com/blog/2008/03/… and blog.regehr.org/archives/26 - Michael Burr
Sounds like a job for valgrind. - Jonas Schäfer

1 Answers

2
votes

The most likely explanation is that there's a memory bug in your program (writing to freed memory, buffer overrun, etc). An outright bug in malloc() is far less likely.