Added support for osg::MemoryManager which is based upon Paul Nettle's
memory manager published at flipcode.com. This can be turned on with the OSG_USE_MEMORY_MANGER option which then uses custom global new and delete operators as well as provide osgNew and osgDelete macro's which add ability to log line and file from which calls are made. Updated osg,osgUtil,osgDB,osgText and osgPlugins/osg to use osgNew/osgDelete, and fixed memory leaks highlighted by the new memory manager.
This commit is contained in:
@@ -23,8 +23,8 @@ class Group;
|
||||
* and accept methods. Use when subclassing from Node to make it
|
||||
* more convinient to define the required pure virtual methods.*/
|
||||
#define META_Node(name) \
|
||||
virtual osg::Object* cloneType() const { return new name (); } \
|
||||
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \
|
||||
virtual osg::Object* cloneType() const { return osgNew name (); } \
|
||||
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return osgNew name (*this,copyop); } \
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
|
||||
virtual const char* className() const { return #name; } \
|
||||
virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } } \
|
||||
@@ -46,10 +46,10 @@ class SG_EXPORT Node : public Object
|
||||
Node(const Node&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
/** clone the an object of the same type as the node.*/
|
||||
virtual Object* cloneType() const { return new Node(); }
|
||||
virtual Object* cloneType() const { return osgNew Node(); }
|
||||
|
||||
/** return a clone of a node, with Object* return type.*/
|
||||
virtual Object* clone(const CopyOp& copyop) const { return new Node(*this,copyop); }
|
||||
virtual Object* clone(const CopyOp& copyop) const { return osgNew Node(*this,copyop); }
|
||||
|
||||
/** return true if this and obj are of the same kind of object.*/
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Node*>(obj)!=NULL; }
|
||||
|
||||
Reference in New Issue
Block a user