Page 1 of 1

Removing Meshes from scene and/or memory [Help needed badly!

Posted: Fri Apr 22, 2011 10:12 pm
by DoritoX
Hey,

For the past few days, i've been searching my butt off on how to actually remove meshes from the scenemanager and or the memory.

Everytime i try "getSceneNodeFrom[Id/Name/etc.](...)->remove[ /All]();
the application freezes.
If i just test "sydney->remove[ /All](); or smgr->remove[ /All](sydney); it also just freezes.

I decided to come ask for help, I would appreciate it alot!

Thanks!!

Posted: Fri Apr 22, 2011 10:14 pm
by Radikalizm
Try to use smgr->addToDeletionQueue(ISceneNode* node), this will let the scene manager remove a node as soon as it's safe to remove it

http://irrlicht.sourceforge.net/docu/cl ... 8d7bf31f5a

Posted: Fri Apr 22, 2011 10:29 pm
by DoritoX
Thanks for the fast reply,
However, my game still freezes!

Posted: Fri Apr 22, 2011 10:30 pm
by Radikalizm
Any error codes? Warnings? Crashes? Or is it just a freeze, and nothing else?

Posted: Fri Apr 22, 2011 11:10 pm
by DoritoX
Just a freeze unfortunately, however i think i may have found it
it turned out to be a fault in another class i made.

So thanks alot, i'm good now!

so final question(s), does this function remove both texture+mesh?
and also, does it remove it/them from just the scene? or also the memory?

Thanks!

Posted: Fri Apr 22, 2011 11:15 pm
by Radikalizm
I can't answer this for sure, it's been a while since I've had to do actual heavy memory management in irrlicht
I do know however that there is an issue with removing textures from memory, I believe it's something to do with the fact that it isn't that easy to check whether they are still being referenced by an object or not

Posted: Sat Apr 23, 2011 6:06 am
by serengeor
It shouldn't be removed since other nodes might be using it at that moment, so you should clean them from IVideoDriver class. But you also shouldn't remove the texture everytime you remove node thats using it, unless its important in what you plan.

Posted: Sat Apr 23, 2011 11:11 am
by hybrid
All textures and meshes are stored in their caches. So when removing from the scene graph, you still have one version in the cache. You can remove them from mesh manually, and then also free the memory (both CPU and GPU).