如何捕获HEAP [new.win32.exe]:为RtlValidateHeap指定的无效地址(002C0000,02E43AA8)

时间:2013-08-25 11:19:10

标签: c++ visual-studio-2012

我尝试在visual studio 2012中捕获无效地址 在非常简单的代码中,我如何捕获它。 这是我在尝试运行代码时得到的:

HEAP[match2_new.win32.exe]: Invalid address specified to RtlValidateHeap( 002C0000, 02E43AA8 )
match2_new.win32.exe has triggered a breakpoint.

这是堆栈:

    msvcr110d.dll!_CrtIsValidHeapPointer(const void * pUserData) Line 2036  C++
    msvcr110d.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1322   C++
    msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1265  C++
    msvcr110d.dll!operator delete(void * pUserData) Line 54 C++
    match2_new.win32.exe!std::allocator<std::_Container_proxy>::deallocate(std::_Container_proxy * _Ptr, unsigned int __formal) Line 586    C++
    match2_new.win32.exe!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::_Free_proxy() Line 683 C++
    match2_new.win32.exe!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >() Line 656  C++
    match2_new.win32.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 965  C++
>   match2_new.win32.exe!GameController::setGemsInBoard(int levlnumber) Line 98 C++
    match2_new.win32.exe!GameLayer::startGame() Line 53 C++
    match2_new.win32.exe!GameScene::init() Line 43  C++
    match2_new.win32.exe!GameScene::create() Line 24    C++
    match2_new.win32.exe!GameScene::scene() Line 19 C++
    match2_new.win32.exe!AppDelegate::applicationDidFinishLaunching() Line 109  C++
    libcocos2d.dll!cocos2d::CCApplication::run() Line 47    C++
    match2_new.win32.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 34  C++
    match2_new.win32.exe!__tmainCRTStartup() Line 528   C
    match2_new.win32.exe!wWinMainCRTStartup() Line 377  C

简单代码:

void GameController::setGemsInBoard(int levlnumber)
{

    switch (levlnumber)
    {
    case 1:
         {
             std::string level_1 = "00011000,00111100,01111110,01111110,01111110,01111110,00111100,00011000";
           fillBoardArray(level_1);
             break;
         }
    case 2:
         {
             std::string level_2 = "00011000,00011000,11111111,11111111,11111111,00111100,00011000,00011000";
             fillBoardArray(level_2);
             break;
         }
    default:
        break;
    }


}

更新

void fillBoardArray(std::string lvlstr);


void GameController::fillBoardArray(std::string lvlstr)
{
   // CCLOG("fillBoardArray");
    int irow=0;
    int icol=0;
    for(int i=0;i<lvlstr.size();i++)
    {
        if(lvlstr[i]=='0')
        {
            m_GemBoardPositionMap[irow][icol] = 0;
            icol++;
        }
        else if(lvlstr[i]=='1')
        {
            m_GemBoardPositionMap[irow][icol] = 1;
            icol++;
        }
        else if(lvlstr[i]==',')
        {
            irow++;
            icol=0;
        }
    }


}

0 个答案:

没有答案
相关问题