Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-08-18 19:37:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-08-18 19:37:31 +0400
commit14d33b3c1fd629ca3ebc2f369b38d9d2ebc09e2e (patch)
tree5304235c3b0bb3f850a0b8e38c96618e9a6cb5aa /source/gameengine/Physics
parent368262461641f23239c1a7bd2e6fa9d5057902e7 (diff)
BGE guardedalloc, Uses WITH_CXX_GUARDEDALLOC but gives a string to MEM_mallocN for better tracking memory usage.
* off by default. * new/delete are at the bottom of each class * python BGE objects have the new/delete in the Py_Header macro.
Diffstat (limited to 'source/gameengine/Physics')
-rw-r--r--source/gameengine/Physics/Bullet/CcdGraphicController.h6
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.h23
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h6
-rw-r--r--source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h6
-rw-r--r--source/gameengine/Physics/common/PHY_IController.h11
-rw-r--r--source/gameengine/Physics/common/PHY_IGraphicController.h7
-rw-r--r--source/gameengine/Physics/common/PHY_IMotionState.h14
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsController.h6
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h18
-rw-r--r--source/gameengine/Physics/common/PHY_IVehicle.h11
10 files changed, 95 insertions, 13 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.h b/source/gameengine/Physics/Bullet/CcdGraphicController.h
index b0626f902c2..99885eb99ee 100644
--- a/source/gameengine/Physics/Bullet/CcdGraphicController.h
+++ b/source/gameengine/Physics/Bullet/CcdGraphicController.h
@@ -75,6 +75,12 @@ private:
btBroadphaseProxy* m_handle;
void* m_newClientInfo;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdGraphicController"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //BULLET2_PHYSICSCONTROLLER_H
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
index 8eb2e616ecf..69b16ca35bd 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
@@ -58,8 +58,6 @@ class btCollisionShape;
class CcdShapeConstructionInfo
{
public:
-
-
static CcdShapeConstructionInfo* FindMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope, bool gimpact);
CcdShapeConstructionInfo() :
@@ -191,6 +189,13 @@ protected:
bool m_forceReInstance; //use gimpact for concave dynamic/moving collision detection
float m_weldingThreshold1; //welding closeby vertices together can improve softbody stability etc.
CcdShapeConstructionInfo* m_shapeProxy; // only used for PHY_SHAPE_PROXY, pointer to actual shape info
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdShapeConstructionInfo"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
struct CcdConstructionInfo
@@ -559,7 +564,11 @@ protected:
}
-
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdPhysicsController"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
@@ -587,7 +596,13 @@ class DefaultMotionState : public PHY_IMotionState
btTransform m_worldTransform;
btVector3 m_localScaling;
-
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:DefaultMotionState"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
index bc5491e00cc..e087eac32c5 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
@@ -275,7 +275,11 @@ protected:
bool m_scalingPropagated;
-
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdPhysicsEnvironment"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //CCDPHYSICSENVIRONMENT
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
index 8dbd137f9de..28440ebdad4 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
@@ -93,6 +93,12 @@ public:
return 0.f;
}
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:DummyPhysicsEnvironment"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //_DUMMYPHYSICSENVIRONMENT
diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h
index 45e93f9d24e..a053a9679b8 100644
--- a/source/gameengine/Physics/common/PHY_IController.h
+++ b/source/gameengine/Physics/common/PHY_IController.h
@@ -31,7 +31,9 @@
#include "PHY_DynamicTypes.h"
-
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
/**
PHY_IController is the abstract simplified Interface to objects
@@ -41,12 +43,17 @@
class PHY_IController
{
public:
-
virtual ~PHY_IController();
// clientinfo for raycasts for example
virtual void* getNewClientInfo()=0;
virtual void setNewClientInfo(void* clientinfo)=0;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IController"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //PHY_ICONTROLLER_H
diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h
index 470d42cb84a..aae971ff42a 100644
--- a/source/gameengine/Physics/common/PHY_IGraphicController.h
+++ b/source/gameengine/Physics/common/PHY_IGraphicController.h
@@ -39,9 +39,7 @@
*/
class PHY_IGraphicController : public PHY_IController
{
-
public:
-
virtual ~PHY_IGraphicController();
/**
SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
@@ -53,6 +51,11 @@ class PHY_IGraphicController : public PHY_IController
virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate) {return 0;}
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IController"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //PHY_IGRAPHICCONTROLLER_H
diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h
index f7bcbd4f2d0..c3d01c010ff 100644
--- a/source/gameengine/Physics/common/PHY_IMotionState.h
+++ b/source/gameengine/Physics/common/PHY_IMotionState.h
@@ -29,6 +29,10 @@
#ifndef PHY__MOTIONSTATE_H
#define PHY__MOTIONSTATE_H
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
/**
PHY_IMotionState is the Interface to explicitly synchronize the world transformation.
Default implementations for mayor graphics libraries like OpenGL and DirectX can be provided.
@@ -36,8 +40,7 @@
class PHY_IMotionState
{
- public:
-
+ public:
virtual ~PHY_IMotionState();
virtual void getWorldPosition(float& posX,float& posY,float& posZ)=0;
@@ -52,6 +55,13 @@ class PHY_IMotionState
virtual void calculateWorldTransformations()=0;
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IMotionState"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //PHY__MOTIONSTATE_H
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h
index d7b8cb0b54f..664e5fddd83 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsController.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsController.h
@@ -41,7 +41,6 @@ class PHY_IPhysicsController : public PHY_IController
{
public:
-
virtual ~PHY_IPhysicsController();
/**
SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
@@ -99,6 +98,11 @@ class PHY_IPhysicsController : public PHY_IController
PHY__Vector3 GetWorldPosition(PHY__Vector3& localpos);
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IPhysicsController"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //PHY_IPHYSICSCONTROLLER_H
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index c76e9d175ce..291dac298dc 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -32,6 +32,11 @@
#include <vector>
#include "PHY_DynamicTypes.h"
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
class PHY_IVehicle;
class RAS_MeshObject;
class PHY_IPhysicsController;
@@ -76,6 +81,12 @@ public:
m_faceNormal(faceNormal)
{
}
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IRayCastFilterCallback"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
/**
@@ -160,6 +171,13 @@ class PHY_IPhysicsEnvironment
virtual void setConstraintParam(int constraintId,int param,float value,float value1) = 0;
virtual float getConstraintParam(int constraintId,int param) = 0;
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IPhysicsEnvironment"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //_IPHYSICSENVIRONMENT
diff --git a/source/gameengine/Physics/common/PHY_IVehicle.h b/source/gameengine/Physics/common/PHY_IVehicle.h
index 498df0dd840..261bae480f5 100644
--- a/source/gameengine/Physics/common/PHY_IVehicle.h
+++ b/source/gameengine/Physics/common/PHY_IVehicle.h
@@ -6,10 +6,13 @@
class PHY_IMotionState;
#include "PHY_DynamicTypes.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
class PHY_IVehicle
{
public:
-
virtual ~PHY_IVehicle();
virtual void AddWheel(
@@ -52,6 +55,12 @@ public:
virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IVehicle"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //PHY_IVEHICLE_H