The recipe:
Create a TerrainSceneNode, move the camera, render it , remove the node. All this in a loop. The interesting part is, that when I dont move the camera, the memory is stable. If I move the camera, but dont render the memory is stable. The problem occurs only if you move the camera, reinit the node and render it. Is there something missing? I have altered the terrain example to show the problem. Please dont send answers, about why I am doing this, its a test.
Code: Select all
scene::ICameraSceneNode* camera = smgr->addCameraSceneNode(0,core::vector3df(0,1700.0f,0),core::vector3df(1010,0.0f,1100));
for (int j=0;j<500;j++){
scene::ITerrainSceneNode* terrain = smgr->addTerrainSceneNode(
"../../media/terrain-heightmap.bmp",
0, // parent node
-1, // node id
core::vector3df(0.f, 0.f, 0.f), // position
core::vector3df(0.f, 0.f, 0.f), // rotation
core::vector3df(40.f, 4.4f, 40.f), // scale
video::SColor ( 255, 255, 255, 255 ), // vertexColor
5, // maxLOD
scene::ETPS_17, // patchSize
4 // smoothFactor
);
terrain->setMaterialTexture(0,driver->getTexture("../../media/terrain-texture.jpg"));
terrain->setMaterialType(video::EMT_LIGHTMAP);
for (int i=0;i<500;i++){ // move camera forward
camera->setPosition(core::vector3df(0+i*3,1700.0f,0)); //no camera movement no memleak
driver->beginScene( );
smgr->drawAll();
env->drawAll();
driver->endScene();
}
driver->removeHardwareBuffer(terrain->getRenderBuffer());
terrain->remove();
} // end for j