Archived

This topic is now archived and is closed to further replies.

Crashs when releasing alot of VertexBuffers

This topic is 6014 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my game, I have tile based maps with each tile having a vertex buffer. When I increase the map size to large, it crashes when releasing vertex buffers. When I have the map size as 128x128 = 16384 VertexBuffers, its ok, but takes a while to release them all. But when I make the map like 256x256 = 65536 VertexBuffers, it crashes when releasing them all. Here is my release code:
  
for (int i = 0; i < 256; i++)
{
    for (int j = 0; j < 256; j++)
    {
        tile[i][j].m_VertexBuffer->Release();
    }
}
  
It wont finish the loop with a map size this large, I have to ctrl-alt-del the game which has stopped responding. Anyone know why it is crashing here if this is just to many VertexBuffers? I am using D3D8 with an athlon 650 + voodoo3. Possibility

Share this post


Link to post
Share on other sites
SWEET! I figured it out. With an extreme amount of vertex buffers as I have, they have to be released in reverse order of their creation.

My game actually wasnt crashing, it was just taking about 15min to release all the vertex buffers.

But when I reversed the order of their release like so:

  
for (int y = Map->m_MapHeight-1; y >= 0; y--)
for (int x = Map->m_MapWidth-1; x >= 0; x--)
Map->tile[y][x].InvalidateDeviceObjects();


it only took a few seconds!

And I have tried maps of size 512x512 (= 262,144 vertex buffers) and it still works fine.

Oh, and of course I do use SAFE_RELEASE.

Possibility

Share this post


Link to post
Share on other sites