Mesh and its name not being deallocated

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
darkliquid
Posts: 41
Joined: Sun Nov 09, 2003 10:12 am
Location: UK
Contact:

Mesh and its name not being deallocated

Post by darkliquid »

When you are using say, this:

Code: Select all

IAnimatedMesh * hillplane = smgr->addHillPlaneMesh("myHill",
        core::dimension2d<f32>(20,20),
        core::dimension2d<s32>(40,40), 0, 0,
        core::dimension2d<f32>(0,0),
        core::dimension2d<f32>(10,10));

IMesh *	mesh = hillplane->getMesh(0);

scene::ISceneNode * node = smgr->addWaterSurfaceSceneNode(mesh, 3.0f, 300.0f, 30.0f);

node->remove();

hillplane = smgr->addHillPlaneMesh("myHill",
                core::dimension2d<f32>(40,40),
                core::dimension2d<s32>(80,80), 0, 0,
                core::dimension2d<f32>(0,0),
                core::dimension2d<f32>(20,20));

mesh = hillplane->getMesh(0);

scene::ISceneNode * node = smgr->addWaterSurfaceSceneNode(mesh, 3.0f, 300.0f, 30.0f);

you get a crash. I thought that when a node was removed, its resources were automagically dropped, so that the mesh created as 'hillplane' would become deallocated. If this is so, then the name to create for at doesn't get removed from the list, so that if you create something else of the same name, the call fails, and so 'hillplane' becomes an invalid pointer, making hillplane->getMesh(0); crash the app.

I've tried using combinations mesh->drop and hillplane->drop() to force it to deallocate, but it doesn't want any of it. Nothing I do seems to be able to deallocate that name entry or the mesh.

What am I doing wrong? Is there some way to remove a mesh and its name entry from the engine that I've missed somewhere?
http://www.darkliquid.net - Blog, art, poetry
Guest

Post by Guest »

I have the same problem. I can't seem to kill anything. Be it meshes, buttons, or what not. The best I can do is make them invisible....which is a bad solution.
btnBla->drop(); just makes it crash. blnBla = 0; does nothing, and delete btnBla; just crashes once again.

How do you kill things then? Especially meshes and things that waste a lot memory.
Post Reply