(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
Baidu looked at the possibility that the array somewhere crossed the boundary and wrote the memory that should not be written.
Is there any good way to check where the array crosses the boundary?
女神的闺蜜爱上我2017-06-07 09:26:17
What is the use of using bt to view the stack...
Since you wrote the code, double check some syntax, this is the most direct way. Set a few key breakpoints and execute them step by step, and you will quickly find the problem.
In addition, the dump method is also an effective way to solve similar errors.