sYSMALLOc:断言失败 - 任何想法如何有效调试? [英] sYSMALLOc: Assertion failed - any ideas how to debug effectively?

查看:176
本文介绍了sYSMALLOc:断言失败 - 任何想法如何有效调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  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。

gdb backtrace:

在malloc.c:3071 
#5 _int_malloc(av = #4 0x002a8300在malloc.c:4702
#6 0x002a9898 in * __ GI___libc_malloc(bytes = 16)at malloc.c:3638
#7 0x0804d575在xmpp_ctx_new(mem)中输入> bytes =< value optimized out> = 0x0,log = 0x0)at src / ctx.c:383
#8 0x0804916e in main(argc = 1,argv = 0xbffff834)at ../src/adminbot.c:277

任何想法要尝试什么?我无法在我的代码中找到错误,它可能是XMPP库中的错误,我需要确定。



谢谢。

解决方案

这几乎肯定是由于您的代码中的堆损坏错误(在刚刚分配的块之前写入)。



由于你显然是在Linux上,所以在这里使用的工具是 Valgrind 。它应该直接指向您的问题,即使在您的守护进程工作的机器上也应该这样做。



除了Valgrind以外的任何其他问题,可能浪费时间。


My server daemon works fine on most machines however on one I am getting:

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.

gdb backtrace:

#4  0x002a8300 in sYSMALLOc (av=<value optimised out>, bytes=<value optimised out>) at malloc.c:3071
#5  _int_malloc (av=<value optimised out>, bytes=<value optimised out>) at malloc.c:4702
#6  0x002a9898 in *__GI___libc_malloc (bytes=16) at malloc.c:3638
#7  0x0804d575 in xmpp_ctx_new (mem=0x0, log=0x0) at src/ctx.c:383
#8  0x0804916e in main (argc=1, argv=0xbffff834) at ../src/adminbot.c:277

Any ideas what to try else ? I am unable to find a bug in my code, it could be a bug in the XMPP library and I need to determine that.

Thanks.

解决方案

This is almost certainly due to a heap corruption bug in your code (writing just before or just after an allocated block).

Since you are apparently on Linux, the tool to use here is Valgrind. It should point you straight at the problem, and it should do so even on machines where your daemon "works".

Trying anything other than Valgrind for this kind of problem is likely a waste of time.

这篇关于sYSMALLOc:断言失败 - 任何想法如何有效调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆