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:
@@ -154,7 +154,7 @@ void IntersectVisitor::reset()
|
||||
_intersectStateStack.clear();
|
||||
|
||||
// create a empty IntersectState on the the intersectStateStack.
|
||||
IntersectState* nis = new IntersectState;
|
||||
IntersectState* nis = osgNew IntersectState;
|
||||
|
||||
_intersectStateStack.push_back(nis);
|
||||
|
||||
@@ -193,7 +193,7 @@ void IntersectVisitor::addLineSegment(LineSegment* seg)
|
||||
|
||||
// create a new segment transformed to local coordintes.
|
||||
IntersectState* cis = _intersectStateStack.back().get();
|
||||
LineSegment* ns = new LineSegment;
|
||||
LineSegment* ns = osgNew LineSegment;
|
||||
|
||||
if (cis->_inverse.valid()) ns->mult(*seg,*(cis->_inverse));
|
||||
else *ns = *seg;
|
||||
@@ -205,21 +205,21 @@ void IntersectVisitor::addLineSegment(LineSegment* seg)
|
||||
|
||||
void IntersectVisitor::pushMatrix(const Matrix& matrix)
|
||||
{
|
||||
IntersectState* nis = new IntersectState;
|
||||
IntersectState* nis = osgNew IntersectState;
|
||||
|
||||
IntersectState* cis = _intersectStateStack.back().get();
|
||||
|
||||
if (cis->_matrix.valid())
|
||||
{
|
||||
nis->_matrix = new Matrix;
|
||||
nis->_matrix = osgNew Matrix;
|
||||
nis->_matrix->mult(matrix,*(cis->_matrix));
|
||||
}
|
||||
else
|
||||
{
|
||||
nis->_matrix = new Matrix(matrix);
|
||||
nis->_matrix = osgNew Matrix(matrix);
|
||||
}
|
||||
|
||||
Matrix* inverse_world = new Matrix;
|
||||
Matrix* inverse_world = osgNew Matrix;
|
||||
inverse_world->invert(*(nis->_matrix));
|
||||
nis->_inverse = inverse_world;
|
||||
|
||||
@@ -231,7 +231,7 @@ void IntersectVisitor::pushMatrix(const Matrix& matrix)
|
||||
{
|
||||
if ((segMaskIn & mask))
|
||||
{
|
||||
LineSegment* seg = new LineSegment;
|
||||
LineSegment* seg = osgNew LineSegment;
|
||||
seg->mult(*(sitr->first),*inverse_world);
|
||||
nis->addLineSegmentPair(sitr->first.get(),seg);
|
||||
}
|
||||
@@ -540,7 +540,7 @@ void IntersectVisitor::apply(Transform& node)
|
||||
{
|
||||
if (!enterNode(node)) return;
|
||||
|
||||
osg::ref_ptr<Matrix> matrix = new Matrix;
|
||||
osg::ref_ptr<Matrix> matrix = osgNew Matrix;
|
||||
node.getLocalToWorldMatrix(*matrix,this);
|
||||
|
||||
pushMatrix(*matrix);
|
||||
|
||||
Reference in New Issue
Block a user