Search code examples
memorydirectxstack-overflowdirectx-9directx-10

If you want to fix bug between f5 and ctrl + F5 on Visual Studio 2008?


When I build my project and run game, I get this error always.

  Unhandled exception at 0x76fb2073 in Screen.exe: 0xC0000005: Access violation writing location 0x00000338 or sometimes 0x00000000.

When I debug this error, I can see the free.c source file.

.....

        else    //  __active_heap == __SYSTEM_HEAP
#endif  /* _WIN64 */
        {
            retval = HeapFree(_crtheap, 0, pBlock);
            **if (retval == 0)                  // Here, error occured**
            {
                errno = _get_errno_from_oserr(GetLastError());
            }
        }
}

......

When I trace this debug path, I found that error occured on this line on my screen.cpp file.

if(FAILED(D3DXLoadMeshFromX(szName, D3DXMESH_SYSTEMMEM,
        m_pd3dDevice, &pAdjacencyBuffer,
        &pD3DXMtrlBuffer, NULL, &pMesh->dwNumMaterial,
        &pMesh->pMesh)))

I can't know why this error occur all time when I run this game.

Need your help!

Oh, Yes.

I forgoted one thing.

When I run project by press key-F5, whether it runs on full screen or window mode, game works good.

Only When I press Ctrl + F5, the error occur.


Solution

  • I've solved this problem my self. I build my file as debug file. Then it works good.