Memory leak while updating terrain heightmap

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Grz-
Posts: 62
Joined: Wed Dec 26, 2007 1:06 pm

Memory leak while updating terrain heightmap

Post by Grz- »

Hello,

i have a memory leak of about 3mb when i reload a terrain heightmap with that code:

Code: Select all

                io::IReadFile *heightmap = device->getFileSystem()->createAndOpenFile("data/heightmap.bmp");
                terrain->loadHeightMap(heightmap);
                heightmap->drop();
I have tried to re-add the scene node after dropping it but it has the same result... is it my code or an irrlicht problem?
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Post by bonsalty »

1) you have to call device->removeAllHardwareBuffer if you want to remove the cache. Besides the terrainSceneNode leaks in DirectX see my early posts about texturing and terrain combo problems. Many people will have this problem too I bet.
2)Use OpenGL.
Tomi
Grz-
Posts: 62
Joined: Wed Dec 26, 2007 1:06 pm

Post by Grz- »

Thank, it is resolved somehow, i use OpenGL and used removeAllHardwareBuffer but it still leak with loadHeightMap but not when i drop the scene node, clear, and re-add the terrain.

PS: Does removeAllHardwareBuffer have any effect on other part of the engine? I hope it doesn't screw others loaded things when called.
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Post by bonsalty »

Yeah, terrain->loadHeightMap(heightmap); sucks

Use instead addTerrainSceneNode , it does the same, but doesnt leak.
Tomi
Post Reply