Best(Safest) way to clean the whole scene


03-12-2006 21:03:28

Hi all! Great job with Mogre!

Sorry for a dumb question, I have a project where scenes must be loaded and cleared quite often so doing this unapropriate would probably cause some memory leakage.
What would be the best/safest(without leaking) way to clean the whole scene(scene nodes/entities, lights, materials, textures etc.) in Mogre.
Is is via Dispose methods or something else.

And another one ... what would be the safest way to clear/destroy scene node and attached entity, and all materials and textures associated with it.

Sorry for this rather stupid questions, but I'm not at home right now(and will not be for a few days) and can't really test this but need the info on this.



03-12-2006 23:24:10

Roughly, the same rules of native Ogre apply to Mogre too. To be more specific:

-If you create an object through the Ogre API (with a 'CreateXXX' method) you should call the associative 'DestroyXXX' method to clear it up. (Note that calling Dispose in this case will do nothing)

-If you 'new' an object, you should call Dispose on it when you are done with it to clear it up. Note that STL container wrappers (NameValuePairList etc.) can get cleaned up at finalization, thus it's not absolutely necessary to call Dispose on them.


05-12-2006 00:37:33

Many thanks Bekas!