Removing an object

Whats the best way to remove a model from memory? I don’t want to just hide it, but I want the memory associated with it released too.

Does the remove function on a nodepath do this?

From the auto-generated python documentation:

void NodePath::remove_node(void);
// Function: NodePath::remove_node
// Access: Published
// Description: Disconnects the referenced node from the scene graph.
// This will also delete the node if there are no other
// pointers to it.
// Normally, this should be called only when you are
// really done with the node. If you want to remove a
// node from the scene graph but keep it around for
// later, you should probably use detach_node() instead.
// In practice, the only difference between
// remove_node() and detach_node() is that remove_node()
// also resets the NodePath to empty, which will cause
// the node to be deleted immediately if there are no
// other references. On the other hand, detach_node()
// leaves the NodePath referencing the node, which will
// keep at least one reference to the node for as long
// as the NodePath exists.