Does remove() deallocate memory?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
eudemon
Posts: 14
Joined: Mon Jul 04, 2005 2:48 am

Does remove() deallocate memory?

Post by eudemon »

I've decided to try to write a dymanic terrain loader in irrlicht. Before I proceed though, does anyone know if the remove function deallocates the memory for the scene node?

At first I assumed so, but it appears that the children nodes are not removed, so I was unsure. Are children just parented to the grandparent scene node before the deletion? Or is the removed node kept in some fashion to keep track of the children?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Have a look at the destructor for the base class ISceneNode.

When a scene node is destructed, all of its children scene nodes are dropped in a single call to removeAll(). When the children are removed, their parent pointer is set to NULL. Remember that all scene nodes are reference counted, so they may not be destructed when the parent node is. They will be destroyed when the last reference to them is dropped.
Post Reply