Questions on memory management convention

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
wqking
Posts: 11
Joined: Wed Nov 14, 2012 9:46 am

Questions on memory management convention

Post by wqking »

I have some questions on how Irrlicht management memory. I didn't find the document about that.

1, We should never use C++ "delete", right?

2, All objects are inherited from IReferenceCounted, that's why we don't "delete", right?

3, Is there any name convention? Is any function name start with "createXXX" returning an object and transfer the ownership? That's to say, for any object returned by createXXX, we must "drop" it?

4, From this page,
http://spottedsun.com/irrlicht-drop-remove-and-delete/
For ISceneNode, we should use "remove" instead of "drop", right?

Thanks in advance.
http://www.cpgf.org/
cpgf library -- free C++ open source library for reflection, serialization, script binding, callbacks, and meta data for OpenGL Box2D, SFML and Irrlicht.
v1.5.3 was released. Now supports Irrlicht 3D engine v1.8 in script binding.
CuteAlien
Admin
Posts: 9927
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Questions on memory management convention

Post by CuteAlien »

Yes, it's pretty much just as you said. See the documentation for IReferenceCounted: http://irrlicht.sourceforge.net/docu/cl ... unted.html

And about ISceneNode - the remove is really about removing it from the scenemanager - it just deletes as well if no one else has a reference anymore. Personally I think ISceneNode::remove should probably have been ISceneManager::removeNode instead to make this more clear - at least you should think of it like that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply