简体   繁体   中英

malloc.c:3074 error?

When I write a C program, I encountered a problem that is as follows:

malloc.c:3074: 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.

Please help me to fix it, thanks in advance!

It seems like the administration kept for memory allocation has been corrupted. My guess would be that you have something like a buffer overflow somewhere before this error occurs.

As the error is a result of an earlier problem (assuming I'm right), this can be a somewhat difficult problem to fix. Perhaps a tool like valgrind can help you to detect incorrect writes to memory. If you have a small program that demonstrates the problem, I would suggest adding that code to your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM