Releasing GPU memory

codo

05-01-2008 13:08:05

Hello, I'm having problems with out of memory bug in my game.

When I load a new game NVperfhud shows that the game consumes 100MB of card memory. Then I go exit to main menu and clear everything out:

MaterialManager.Singleton.UnloadUnreferencedResources();
sceneMgr.ClearScene();
sceneMgr.DestroyAllAnimations();
sceneMgr.DestroyAllBillboardSets();
sceneMgr.DestroyAllEntities();
sceneMgr.DestroyAllLights();
sceneMgr.DestroyAllStaticGeometry();
sceneMgr.DestroyAllMovableObjects();
MeshManager.Singleton.RemoveAll();

if (camera != null)
{
camera.SceneManager.DestroyCamera(camera.Name);
//camera.Dispose();
camera = null;
}

this.window.RemoveAllViewports();
CompositorManager.Singleton.RemoveAll();



The green bar is almost of the same height - let's say 98MB. Then I start the game again. New memory comsumption takes place after a while it's 120MB. Exit to menu (clearing, reinitializing), new game: 140MB.

Is this normal?

codo

05-01-2008 13:38:58

After loading different game levels a few times the amount of memory used by GPU is constant and about 350MB. Would it crash on 128MB card? Or is this just a memory cache which is freed only when necessary?

Marioko

06-01-2008 01:52:35

i never has problems with GPU, i have a 128mb video card and load very huge scenes, is slow (6 FPS) because shaders and the numbers of mesh, but never crash. When i finish the game, i only return false in frameStarted or frameEnded delegates methods and everything work fine.

codo

06-01-2008 12:58:47

Hmmm...
MeshManager.Singleton.RemoveAll(); do I have to call this every time?

How do you clear everything before loading a new game 'level'?

codo

06-01-2008 13:07:29

another problem: when testing on GF2 MX 400 i start the game, everything is ok. Then i exit to Windows (XP) and then start the game again, and I get:

"Cannot create D3D9 vertex buffer: Ran out of memory"

codo

07-01-2008 15:47:08

Same problem occurs on Geforce4 MX

codo

07-01-2008 17:14:19

Maybe it's something with my code?

Could you please write how you dispose meshes, materials, scenes and shutdown? I couldn't find any tutorial on this subject (apart from: 'call dispose() and set to null').

When I have a list of sceneNodes is this ok to call list.Clear() and then root.destroySceneManager ?