diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-18 19:37:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-18 19:37:31 +0400 |
commit | 14d33b3c1fd629ca3ebc2f369b38d9d2ebc09e2e (patch) | |
tree | 5304235c3b0bb3f850a0b8e38c96618e9a6cb5aa /source/gameengine/Ketsji | |
parent | 368262461641f23239c1a7bd2e6fa9d5057902e7 (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/Ketsji')
35 files changed, 297 insertions, 8 deletions
diff --git a/source/gameengine/Ketsji/BL_BlenderShader.h b/source/gameengine/Ketsji/BL_BlenderShader.h index 9af53bfc863..073ce8f1ca5 100644 --- a/source/gameengine/Ketsji/BL_BlenderShader.h +++ b/source/gameengine/Ketsji/BL_BlenderShader.h @@ -57,6 +57,13 @@ public: int GetBlendMode(); bool Equals(BL_BlenderShader *blshader); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderShader"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif//__BL_GPUSHADER_H__ diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h index 4f572f95891..6b53e7fa8b1 100644 --- a/source/gameengine/Ketsji/BL_Material.h +++ b/source/gameengine/Ketsji/BL_Material.h @@ -4,6 +4,10 @@ #include "STR_String.h" #include "MT_Point2.h" +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + // -- struct MTex; struct Material; @@ -98,6 +102,13 @@ public: void SetSharedMaterial(bool v); bool IsShared(); void SetUsers(int num); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Material"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; // BL_Material::IdMode diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h index 42969996b3e..b2610d7762a 100644 --- a/source/gameengine/Ketsji/BL_Shader.h +++ b/source/gameengine/Ketsji/BL_Shader.h @@ -25,6 +25,12 @@ public: { } int mLoc; // Sampler location + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Sampler"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; /** @@ -65,6 +71,13 @@ public: int GetLocation() { return mLoc; } void* getData() { return mData; } + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Uniform"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; /** @@ -83,6 +96,13 @@ public: int mType; int mLoc; unsigned int mFlag; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_DefUniform"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; /** diff --git a/source/gameengine/Ketsji/BL_Texture.h b/source/gameengine/Ketsji/BL_Texture.h index 830ffceb0f7..2dfd9c542d3 100644 --- a/source/gameengine/Ketsji/BL_Texture.h +++ b/source/gameengine/Ketsji/BL_Texture.h @@ -67,6 +67,12 @@ public: return tmp; } + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_Texture"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif//__BL_TEXTURE_H__ diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h index 605ca207949..cdbdc4bd429 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.h +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h @@ -15,6 +15,10 @@ #include "MT_Vector3.h" #include "MT_Vector4.h" +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + struct MTFace; class KX_Scene; diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h index 755b1cbd780..7fc799abb7e 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h @@ -18,7 +18,6 @@ private: btCollisionShape* m_bulletChildShape; public: - KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound); virtual ~KX_BulletPhysicsController (); @@ -81,6 +80,12 @@ public: // intentionally empty }; + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BulletPhysicsController"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //KX_BULLET2PHYSICS_CONTROLLER diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.h b/source/gameengine/Ketsji/KX_CameraIpoSGController.h index 33245e79c23..85d93962a14 100644 --- a/source/gameengine/Ketsji/KX_CameraIpoSGController.h +++ b/source/gameengine/Ketsji/KX_CameraIpoSGController.h @@ -84,6 +84,13 @@ public: m_modify_clipstart = modify; } void AddInterpolator(KX_IInterpolator* interp); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_CameraIpoSGController"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif // KX_CAMERAIPOSGCONTROLLER_H diff --git a/source/gameengine/Ketsji/KX_ClientObjectInfo.h b/source/gameengine/Ketsji/KX_ClientObjectInfo.h index 1898dc71ef8..74647dd47fd 100644 --- a/source/gameengine/Ketsji/KX_ClientObjectInfo.h +++ b/source/gameengine/Ketsji/KX_ClientObjectInfo.h @@ -74,6 +74,13 @@ public: bool isActor() { return m_type <= ACTOR; } bool isSensor() { return m_type >= SENSOR && m_type <= OBACTORSENSOR; } + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ClientObjectInfo"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_CLIENTOBJECT_INFO_H diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h index 20b60ef0173..9ff33fe2852 100644 --- a/source/gameengine/Ketsji/KX_Dome.h +++ b/source/gameengine/Ketsji/KX_Dome.h @@ -18,7 +18,7 @@ http://www.gnu.org/copyleft/lesser.txt. Contributor(s): Dalai Felinto This source uses some of the ideas and code from Paul Bourke. -Developed as part of a Research and Development project for SAT - La Société des arts technologiques. +Developed as part of a Research and Development project for SAT - La Soci�t� des arts technologiques. ----------------------------------------------------------------------------- */ @@ -78,7 +78,7 @@ public: bool fboSupported; //openGL names: - GLuint domefacesId[7]; // ID of the images -- room for 7 images, using only 4 for 180º x 360º dome, 6 for panoramic and +1 for warp mesh + GLuint domefacesId[7]; // ID of the images -- room for 7 images, using only 4 for 180� x 360� dome, 6 for panoramic and +1 for warp mesh GLuint dlistId; // ID of the Display Lists of the images (used as an offset) typedef struct { @@ -184,6 +184,13 @@ protected: RAS_IRenderTools* m_rendertools; /// engine KX_KetsjiEngine* m_engine; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_Dome"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_EmptyObject.h b/source/gameengine/Ketsji/KX_EmptyObject.h index 62aa7fcd017..fa405e20076 100644 --- a/source/gameengine/Ketsji/KX_EmptyObject.h +++ b/source/gameengine/Ketsji/KX_EmptyObject.h @@ -37,7 +37,13 @@ public: KX_GameObject(sgReplicationInfo,callbacks) {}; virtual ~KX_EmptyObject(); - + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_EmptyObject"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_EMPTYOBJECT diff --git a/source/gameengine/Ketsji/KX_IInterpolator.h b/source/gameengine/Ketsji/KX_IInterpolator.h index 8c899a4db0b..52b9b3be5af 100644 --- a/source/gameengine/Ketsji/KX_IInterpolator.h +++ b/source/gameengine/Ketsji/KX_IInterpolator.h @@ -31,11 +31,22 @@ #include <vector> +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + class KX_IInterpolator { public: virtual ~KX_IInterpolator() {} virtual void Execute(float currentTime) const = 0; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IInterpolator"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; typedef std::vector<KX_IInterpolator *> T_InterpolatorList; diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.h b/source/gameengine/Ketsji/KX_IPO_SGController.h index 031b74294ce..68a74c3a364 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.h +++ b/source/gameengine/Ketsji/KX_IPO_SGController.h @@ -116,6 +116,12 @@ public: m_ipotime = time; m_modified = true; } + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IpoSGController"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__IPO_SGCONTROLLER_H diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.h b/source/gameengine/Ketsji/KX_IPhysicsController.h index 81c01045071..f9dcf81bca5 100644 --- a/source/gameengine/Ketsji/KX_IPhysicsController.h +++ b/source/gameengine/Ketsji/KX_IPhysicsController.h @@ -126,6 +126,13 @@ public: // call from scene graph to update virtual bool Update(double time)=0; void* GetUserData() { return m_userdata;} + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IPhysicsController"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_IPHYSICSCONTROLLER_H diff --git a/source/gameengine/Ketsji/KX_IScalarInterpolator.h b/source/gameengine/Ketsji/KX_IScalarInterpolator.h index 6ba685885e9..ec6183b88a1 100644 --- a/source/gameengine/Ketsji/KX_IScalarInterpolator.h +++ b/source/gameengine/Ketsji/KX_IScalarInterpolator.h @@ -29,11 +29,22 @@ #ifndef KX_ISCALARINTERPOLATOR_H #define KX_ISCALARINTERPOLATOR_H +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + class KX_IScalarInterpolator { public: virtual ~KX_IScalarInterpolator() {} virtual float GetValue(float currentTime) const = 0; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IScalarInterpolator"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_ISceneConverter.h b/source/gameengine/Ketsji/KX_ISceneConverter.h index 45b3276e98c..f098b0bebf5 100644 --- a/source/gameengine/Ketsji/KX_ISceneConverter.h +++ b/source/gameengine/Ketsji/KX_ISceneConverter.h @@ -32,6 +32,10 @@ #include "STR_String.h" #include "KX_Python.h" +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + struct Scene; class KX_ISceneConverter @@ -80,6 +84,13 @@ public: virtual bool GetGLSLMaterials()=0; virtual struct Scene* GetBlenderSceneForName(const STR_String& name)=0; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ISceneConverter"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_ISCENECONVERTER_H diff --git a/source/gameengine/Ketsji/KX_ISystem.h b/source/gameengine/Ketsji/KX_ISystem.h index 204e116e822..deee91f62e8 100644 --- a/source/gameengine/Ketsji/KX_ISystem.h +++ b/source/gameengine/Ketsji/KX_ISystem.h @@ -37,6 +37,10 @@ using namespace std; #include "STR_String.h" +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + /** * System Abstraction, needed only for getting some timing stuff from the host. */ @@ -47,6 +51,13 @@ public: virtual ~KX_ISystem() {}; virtual double GetTimeInSeconds()=0; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ISystem"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index a36b3f163fd..acb9e53df8a 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -190,7 +190,6 @@ private: void DoSound(KX_Scene* scene); public: - KX_KetsjiEngine(class KX_ISystem* system); virtual ~KX_KetsjiEngine(); @@ -396,6 +395,13 @@ protected: bool BeginFrame(); void ClearFrame(); void EndFrame(); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_KetsjiEngine"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_KETSJI_ENGINE diff --git a/source/gameengine/Ketsji/KX_LightIpoSGController.h b/source/gameengine/Ketsji/KX_LightIpoSGController.h index 98870cf5b3f..811dba5dba8 100644 --- a/source/gameengine/Ketsji/KX_LightIpoSGController.h +++ b/source/gameengine/Ketsji/KX_LightIpoSGController.h @@ -92,6 +92,13 @@ public: }; void AddInterpolator(KX_IInterpolator* interp); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_LightIpoSGController"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif // KX_LIGHTIPOSGCONTROLLER_H diff --git a/source/gameengine/Ketsji/KX_MaterialIpoController.h b/source/gameengine/Ketsji/KX_MaterialIpoController.h index 4d2e258bf94..906c12426eb 100644 --- a/source/gameengine/Ketsji/KX_MaterialIpoController.h +++ b/source/gameengine/Ketsji/KX_MaterialIpoController.h @@ -50,6 +50,13 @@ public: void AddInterpolator(KX_IInterpolator* interp); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_MaterialIpoController"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; diff --git a/source/gameengine/Ketsji/KX_MotionState.h b/source/gameengine/Ketsji/KX_MotionState.h index 0e43e88fbeb..63c265aa8a7 100644 --- a/source/gameengine/Ketsji/KX_MotionState.h +++ b/source/gameengine/Ketsji/KX_MotionState.h @@ -31,6 +31,10 @@ #include "PHY_IMotionState.h" +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + class KX_MotionState : public PHY_IMotionState { class SG_Spatial* m_node; @@ -48,6 +52,12 @@ public: virtual void setWorldOrientation(const float* ori); virtual void calculateWorldTransformations(); + + +#ifdef WITH_CXX_GUARDEDALLOC + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_MotionState"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_MOTIONSTATE diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h index 6d63dd77683..a32d027be9c 100644 --- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h +++ b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h @@ -67,6 +67,13 @@ public: void AddInterpolator(KX_IInterpolator* interp); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ObColorIpoSGController"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif // KX_OBCOLORIPOSGCONTROLLER_H diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.h b/source/gameengine/Ketsji/KX_OrientationInterpolator.h index 2bd9f69d824..d8ecc74277c 100644 --- a/source/gameengine/Ketsji/KX_OrientationInterpolator.h +++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.h @@ -50,6 +50,13 @@ public: private: MT_Matrix3x3& m_target; KX_IScalarInterpolator *m_ipos[3]; + + +#ifdef WITH_CXX_GUARDEDALLOC +private: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_OrientationInterpolator"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h index 266b4d7e789..dc42bd2f81b 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.h +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h @@ -35,6 +35,10 @@ #include "RAS_IRasterizer.h" #include "DNA_ID.h" +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + struct MTFace; struct Material; struct MTex; @@ -57,6 +61,7 @@ private: mutable int m_pass; public: + KX_PolygonMaterial(); void Initialize(const STR_String &texname, Material* ma, diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.h b/source/gameengine/Ketsji/KX_PositionInterpolator.h index bff0b4201c2..f6c6fa98a0e 100644 --- a/source/gameengine/Ketsji/KX_PositionInterpolator.h +++ b/source/gameengine/Ketsji/KX_PositionInterpolator.h @@ -50,6 +50,13 @@ public: private: MT_Point3& m_target; KX_IScalarInterpolator *m_ipos[3]; + + +#ifdef WITH_CXX_GUARDEDALLOC +private: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_PositionInterpolator"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_RayCast.h b/source/gameengine/Ketsji/KX_RayCast.h index c3084c997a1..cdafc894f6c 100644 --- a/source/gameengine/Ketsji/KX_RayCast.h +++ b/source/gameengine/Ketsji/KX_RayCast.h @@ -89,6 +89,12 @@ public: const MT_Point3& topoint, KX_RayCast& callback); + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayCast"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; template<class T> class KX_RayCast::Callback : public KX_RayCast @@ -121,7 +127,13 @@ public: } return self->NeedRayCast(info); } - + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayCast::Callback"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; diff --git a/source/gameengine/Ketsji/KX_RayEventManager.h b/source/gameengine/Ketsji/KX_RayEventManager.h index b816d4d5250..27c9be14d1f 100644 --- a/source/gameengine/Ketsji/KX_RayEventManager.h +++ b/source/gameengine/Ketsji/KX_RayEventManager.h @@ -45,6 +45,13 @@ public: m_logicmgr(logicmgr) {} virtual void NextFrame(); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_RayEventManager"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_RAYEVENTMGR diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h index c9baf228855..dd4419543a2 100644 --- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h +++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h @@ -59,7 +59,6 @@ class KX_BoneParentRelation : public SG_ParentRelation { public : - /** * Allocate and construct a new KX_SG_BoneParentRelation * on the heap. @@ -101,6 +100,12 @@ private : KX_BoneParentRelation(Bone* bone ); + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BoneParentRelation"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h index d8fb9211f21..c1640f3e0a0 100644 --- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h +++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h @@ -53,7 +53,6 @@ class KX_NormalParentRelation : public SG_ParentRelation { public : - /** * Allocate and construct a new KX_NormalParentRelation * on the heap. @@ -91,6 +90,12 @@ private : KX_NormalParentRelation( ); + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_NormalParentRelation"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; @@ -142,6 +147,12 @@ private : KX_VertexParentRelation( ); + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_VertexParentRelation"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; @@ -219,6 +230,12 @@ private : bool m_initialized; + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_SlowParentRelation"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.h b/source/gameengine/Ketsji/KX_ScalarInterpolator.h index 8835c98c184..ca011ab5db0 100644 --- a/source/gameengine/Ketsji/KX_ScalarInterpolator.h +++ b/source/gameengine/Ketsji/KX_ScalarInterpolator.h @@ -55,6 +55,13 @@ public: private: MT_Scalar* m_target; KX_IScalarInterpolator *m_ipo; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ScalarInterpolator"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.h b/source/gameengine/Ketsji/KX_ScalingInterpolator.h index a7b5d7e559a..460563d4135 100644 --- a/source/gameengine/Ketsji/KX_ScalingInterpolator.h +++ b/source/gameengine/Ketsji/KX_ScalingInterpolator.h @@ -50,6 +50,13 @@ public: private: MT_Vector3& m_target; KX_IScalarInterpolator *m_ipos[3]; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_ScalingInterpolator"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h index 0cc34b53736..fe15967f93c 100644 --- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h +++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h @@ -125,6 +125,12 @@ protected: /** Maximum number of measurements. */ unsigned int m_maxNumMeasurements; + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TimeCategoryLogger"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif // __KX_TIME_CATEGORY_LOGGER_H diff --git a/source/gameengine/Ketsji/KX_TimeLogger.h b/source/gameengine/Ketsji/KX_TimeLogger.h index 0962f02a877..2e73abc75b5 100644 --- a/source/gameengine/Ketsji/KX_TimeLogger.h +++ b/source/gameengine/Ketsji/KX_TimeLogger.h @@ -36,6 +36,10 @@ #include <deque> +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + /** * Stores and manages time measurements. */ @@ -98,6 +102,13 @@ protected: /** State of logging. */ bool m_logging; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TimeLogger"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif // __KX_TIME_LOGGER_H diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.h b/source/gameengine/Ketsji/KX_TouchEventManager.h index cc77bccfc31..6da37d615a4 100644 --- a/source/gameengine/Ketsji/KX_TouchEventManager.h +++ b/source/gameengine/Ketsji/KX_TouchEventManager.h @@ -76,6 +76,12 @@ public: SCA_LogicManager* GetLogicManager() { return m_logicmgr;} PHY_IPhysicsEnvironment *GetPhysicsEnvironment() { return m_physEnv; } + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_TouchEventManager"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_TOUCHEVENTMANAGER diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h index fe4e0c51b24..2c2346ca38e 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.h +++ b/source/gameengine/Ketsji/KX_WorldInfo.h @@ -31,6 +31,10 @@ #include "MT_Scalar.h" +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + class MT_CmMatrix4x4; class KX_WorldInfo @@ -59,6 +63,13 @@ public: virtual void setMistColorRed(float)=0; virtual void setMistColorGreen(float)=0; virtual void setMistColorBlue(float)=0; + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_WorldInfo"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif //__KX_WORLDINFO_H diff --git a/source/gameengine/Ketsji/KX_WorldIpoController.h b/source/gameengine/Ketsji/KX_WorldIpoController.h index d90c03d09ee..8622d80a35f 100644 --- a/source/gameengine/Ketsji/KX_WorldIpoController.h +++ b/source/gameengine/Ketsji/KX_WorldIpoController.h @@ -90,6 +90,13 @@ public: }; void AddInterpolator(KX_IInterpolator* interp); + + +#ifdef WITH_CXX_GUARDEDALLOC +public: + void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_WorldIpoController"); } + void operator delete( void *mem ) { MEM_freeN(mem); } +#endif }; #endif // KX_LIGHTIPOSGCONTROLLER_H |