First of all i am not sure if am experiencing a bug here or not. If not, i apologize for the wrong blame...
As it seems, the memory is not completely freed when scene nodes and their meshes are not released in the reverse order of creation. I made a small testprogram to reproduce this:
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main(int argc, char **argv)
{
IrrlichtDevice *device = createDevice(video::EDT_OPENGL, dimension2d<u32>(640, 480), 32, false, false, false, 0);
if (!device) {
return 1;
}
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(10,10,260,22), true);
IAnimatedMesh* mesh1 = smgr->getMesh("../../sydney.md2");
IAnimatedMesh* mesh2 = smgr->getMesh("../../sydney(copy).md2");
IAnimatedMeshSceneNode* node1 = smgr->addAnimatedMeshSceneNode(mesh1);
IAnimatedMeshSceneNode* node2 = smgr->addAnimatedMeshSceneNode(mesh2);
smgr->getMeshCache()->removeMesh(mesh1->getMesh(0));
node1->remove();
smgr->getMeshCache()->removeMesh(mesh2->getMesh(0));
node2->remove();
while (device->run()) {
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->closeDevice();
device->drop();
return 0;
}