Page 1 of 1

Memory leak while updating terrain heightmap

Posted: Wed Jul 21, 2010 10:37 am
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?

Posted: Wed Jul 21, 2010 1:33 pm
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.

Posted: Wed Jul 21, 2010 2:48 pm
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.

Posted: Thu Jul 22, 2010 11:15 am
by bonsalty
Yeah, terrain->loadHeightMap(heightmap); sucks

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