gdb에서 나온 걸 결과를 토대로 해봣는데 어디가 문제인지 잘 모르겠네요...
글쓴이: tkfkdgody / 작성시간: 화, 2008/08/05 - 11:45오전
아래는 gdb에서 bt한 결과입니다. 결과를 보면 메모리에 관련된 부분으로만 추측하고 있는데 메모리 문제라 해도 정확히 어떻게 해줘야할지 감이 전혀 안오네요..
#0 0xb7edc408 in std::__default_alloc_template<true, 0>::allocate () from /usr/lib/libstdc++.so.5 #1 0x0805cab8 in std::__simple_alloc<std::_Rb_tree_node<std::pair<std::string const, GamePlayer*> >, std::__default_alloc_template<true, 0> >::allocate (__n=1) at /usr/include/c++/3.3.5/bits/stl_alloc.h:232 #2 0x0805ca86 in std::_Rb_tree_alloc_base<std::pair<std::string const, GamePlayer*>, std::allocator<std::pair<std::string const, GamePlayer*> >, true>::_M_get_node (this=0x8075344) at /usr/include/c++/3.3.5/bits/stl_tree.h:564 #3 0x0805da34 in std::_Rb_tree<std::string, std::pair<std::string const, GamePlayer*>, std::_Select1st<std::pair<std::string const, GamePlayer*> >, std::less<std::string>, std::allocator<std::pair<std::string const, GamePlayer*> > >::_M_create_node (this=0x8075344, __x=@0xb72298d0) at /usr/include/c++/3.3.5/bits/stl_tree.h:616 #4 0x0805d85e in std::_Rb_tree<std::string, std::pair<std::string const, GamePlayer*>, std::_Select1st<std::pair<std::string const, GamePlayer*> >, std::less<std::string>, std::allocator<std::pair<std::string const, GamePlayer*> > >::_M_insert (this=0x8075344, __x_=0x0, __y_=0x808bc00, __v=@0xb72298d0) at /usr/include/c++/3.3.5/bits/stl_tree.h:998 #5 0x0805ce43 in std::_Rb_tree<std::string, std::pair<std::string const, GamePlayer*>, std::_Select1st<std::pair<std::string const, GamePlayer*> >, std::less<std::string>, std::allocator<std::pair<std::string const, GamePlayer*> > >::insert_unique (this=0x8075344, __position= {<std::_Rb_tree_base_iterator> = {_M_node = 0x8076148}, <No data fields>}, __v=@0xb72298d0) at /usr/include/c++/3.3.5/bits/stl_tree.h:1077 #6 0x0805c6a3 in std::map<std::string, GamePlayer*, std::less<std::string>, std::allocator<std::pair<std::string const, GamePlayer*> > >::insert (this=0x8075344, position=Cannot access memory at address 0x0 ) at /usr/include/c++/3.3.5/bits/stl_map.h:364 #7 0x0805c5c9 in std::map<std::string, GamePlayer*, std::less<std::string>, std::allocator<std::pair<std::string const, GamePlayer*> > >::operator[] (this=0x8075344, __k=@0xb72299f0) at /usr/include/c++/3.3.5/bits/stl_map.h:319 ---Type <return> to continue, or q <return> to quit--- #8 0x0805b7d7 in PlayerControler::Login (this=0xb7229b20, forMap= {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<No data fields>}, _M_p = 0x8076cbc "?\t\b훝\a\b0\034\t\b\b"}, static _S_empty_rep_storage = {0, 0, 20, 0}}, gameServerID=4294967295, account=0xb7229ab0 "\203W\203F\203h\203X", ip=0xb7229af0 "d11e814b", charname=0xb7229ad0 "\b\203W\203F\203h\203X") at ../user.cpp:163 #9 0x0805baf8 in PlayerControler::Announce (this=0xb7229b20, forMap= {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<No data fields>}, _M_p = 0x8076cbc "?\t\b훝\a\b0\034\t\b\b"}, static _S_empty_rep_storage = {0, 0, 20, 0}}, gameServerID=4294967295, account=0xb7229ab0 "\203W\203F\203h\203X", ip=0xb7229af0 "d11e814b", charname=0xb7229ad0 "\b\203W\203F\203h\203X") at ../user.cpp:251 #10 0x080516ba in NoticeListener::Run (this=0x806e3e0) at ../NoticeListener.cpp:226 #11 0x08051d5e in _BaseThreadProc_ (lpParameter=0x806e3e0) at ../base_thread.cpp:7 #12 0xb7e1e112 in start_thread () from /lib/libpthread.so.0 #13 0xb7d832ee in clone () from /lib/libc.so.6
아래는 PlayerControler::Login()에 관한 내용입니다.
void PlayerControler::Login (std::string forMap, dword gameServerID, const char* account, const char* ip, const char* charname) { isOnline = true; std::map<std::string, GamePlayer*>::iterator it = m_acctMap.find(account); if (it != m_acctMap.end()) { GamePlayer* player; player = it->second; } else { // 새로운 유저일 경우 this->m_mutex.Lock(); GamePlayer* player = new GamePlayer(); m_acctMap[account] = player; player->m_account = account; player->m_charname = charname; //player->m_mutex.Lock(); this->m_mutex.Unlock(); isOnline = false; player->LineOn(forMap, gameServerID, ip); m_map[forMap] = player; } if (!isOnline) { std::map<std::string, GamePlayer*>::iterator that = m_map.find(forMap); if (that == m_map.end()) { isOnline = true; } else { isOnline = false; } } if (isOnline) { Logout(forMap); } m_playerCount += 1; }
몇일째 하는데 잘 안되네요. 조언 좀 부탁드리겠습니다.
Forums:
댓글 달기