(gdb) bt
#0 0x000000368d275fd5 in malloc_consolidate () from /lib64/libc.so.6
#1 0x000000368d279c28 in _int_malloc () from /lib64/libc.so.6
#2 0x000000368d27ab1c in malloc () from /lib64/libc.so.6
#3 0x000000368debd09d in operator new(unsigned long) () from /usr/lib64/libstdc++.so.6
#4 0x000000000040fbcd in __gnu_cxx::new_allocator<unsigned char>::allocate (this=0x7ffc7e0136d8, __n=4096)
at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/new_allocator.h:89
#5 0x000000000040f575 in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate (this=0x7ffc7e0136d8, __n=4096)
at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h:140
#6 0x000000000040f186 in std::vector<unsigned char, std::allocator<unsigned char> >::_M_allocate_and_copy<unsigned char*> (this=0x7ffc7e0136d8,
__n=4096, __first=0x0, __last=0x0) at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h:963
#7 0x000000000040e7c7 in std::vector<unsigned char, std::allocator<unsigned char> >::reserve (this=0x7ffc7e0136d8, __n=4096)
at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/vector.tcc:74
#8 0x00000000004cc616 in ByteBuffer::ByteBuffer (this=0x7ffc7e0136c0) at ../../../../src/shared/./util/ByteBuffer.h:19
#9 0x00000000004cb947 in ReplayMgr::SaveToDB (this=0x23a40d0, pBase=0x57a1160) at ./Replay/ReplayMgr.cpp:95
百度了下可能是某个地方数组越界把不该写的内存写坏了
请问有没有什么好的办法检查数组越界的地方具体在哪里?
女神的闺蜜爱上我2017-06-07 09:26:17
你用 bt 查看堆栈有什么用...
既然代码是你写的,仔细检查一些语法,这是最直接的方法。下几个关键的断点,一步步执行一下,很快就能发现问题所在。
另外,dump法也是解决类似错误的有效途径。