Program terminated with signal 11, Segmentation fault.
#0 0x000000368d275fd5 in malloc_consolidate () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.5-7.el6_0.x86_64 cyrus-sasl-lib-2.1.23-13.el6_3.1.x86_64 glibc-2.12-1.166.el6_7.7.x86_64 keyutils-libs-1.4-5.el6.x86_64 krb5-libs-1.10.3-65.el6.x86_64 libcom_err-1.41.12-23.el6.x86_64 libcurl-7.19.7-37.el6_5.3.x86_64 libgcc-4.4.7-4.el6.x86_64 libidn-1.18-2.el6.x86_64 libselinux-2.0.94-7.el6.x86_64 libssh2-1.4.2-1.el6.x86_64 libstdc++-4.4.7-4.el6.x86_64 nspr-4.10.6-1.el6_5.x86_64 nss-3.16.1-4.el6_5.x86_64 nss-softokn-freebl-3.14.3-10.el6_5.x86_64 nss-util-3.16.1-1.el6_5.x86_64 openldap-2.4.23-34.el6_5.1.x86_64 openssl-1.0.1e-57.el6.x86_64 zlib-1.2.3-29.el6.x86_64
(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
#10 0x0000000000484aa1 in Room_YunNan_FeiXiaoJi_MahJong::OnEventGameConclude (this=0x5a163b0, cbReason=0 'rrreee0', isNormal=true)
at ./Room/Room_YunNan_FeiXiaoJi_MahJong.cpp:849
#11 0x000000000048c33a in Room_YunNan_FeiXiaoJi_MahJong::OnUserOperateCard (this=0x5a163b0, wChairID=3, cbOperateCode=64 '@', cbOperateCard=0x7ffc7e013d59 "")
at ./Room/Room_YunNan_FeiXiaoJi_MahJong.cpp:2436
#12 0x000000000046771b in Player::HandleYNFXJOperateCard (this=0x27d7260, recvPacket=...) at ./Player/Player.cpp:513
#13 0x000000000043bcbc in GameSession::OnDealData (this=0x7fa9e4000b30, packet=0x7fa9e4000930) at ./GameSession/GameSession.cpp:61
#14 0x0000000000524f2d in Session::DealPacket (this=0x7fa9e4000b30) at ./Net/Session.cpp:110
#15 0x0000000000525044 in Session::DealData (this=0x7fa9e4000b30) at ./Net/Session.cpp:149
#16 0x00000000005253c9 in Session::Update (this=0x7fa9e4000b30) at ./Net/Session.cpp:264
#17 0x0000000000525ec7 in SessionMgr::Update (this=0x23623d0) at ./Net/SessionMgr.cpp:66
#18 0x00000000004bc11d in UserInterface::OnRun (this=0xab1c60) at ./User/UserInterface.cpp:124
#19 0x0000000000475811 in Master::Loop (this=0xab1bc0) at ./Master.cpp:217
#20 0x000000000047532a in Master::Run (this=0xab1bc0) at ./Master.cpp:84
#21 0x00000000004c841c in unix_main (argc=1, argv=0x7ffc7e014248) at ./main.cpp:119
#22 0x00000000004c84b7 in main (argc=1, argv=0x7ffc7e014248) at ./main.cpp:142
This is the call stack of the core file. It is not convenient to post the code. What are the common reasons for this situation?
某草草2017-06-23 09:16:58
A Segmentation fault occurred. The basic reason is illegal memory access. Malloc appears in many of your error messages, which means to apply for memory. The vector's reserve increases the vector's capacity, but its size does not change! Reserve is a container reserved space, but element objects are not actually created in the space, so elements in the container cannot be referenced before adding new objects. When adding a new element, call the push_back()/insert() function. Since you don’t have the code, it’s difficult for me to determine the reason. The above is my personal opinion. I hope it can help you. Thank you for inviting me to answer.