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/GameLogic
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/GameLogic')
-rw-r--r--source/gameengine/GameLogic/SCA_ActuatorEventManager.h7
-rw-r--r--source/gameengine/GameLogic/SCA_AlwaysEventManager.h5
-rw-r--r--source/gameengine/GameLogic/SCA_EventManager.h7
-rw-r--r--source/gameengine/GameLogic/SCA_ExpressionController.h7
-rw-r--r--source/gameengine/GameLogic/SCA_IActuator.h7
-rw-r--r--source/gameengine/GameLogic/SCA_IInputDevice.h10
-rw-r--r--source/gameengine/GameLogic/SCA_IScene.h11
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickManager.h6
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardManager.h7
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h7
-rw-r--r--source/gameengine/GameLogic/SCA_MouseManager.h7
-rw-r--r--source/gameengine/GameLogic/SCA_PropertyEventManager.h6
-rw-r--r--source/gameengine/GameLogic/SCA_RandomEventManager.h7
-rw-r--r--source/gameengine/GameLogic/SCA_RandomNumberGenerator.h11
-rw-r--r--source/gameengine/GameLogic/SCA_TimeEventManager.h7
15 files changed, 112 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h b/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
index a7d61627c23..f3884c87a75 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
+++ b/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
@@ -45,6 +45,13 @@ public:
virtual void NextFrame();
virtual void UpdateFrame();
//SCA_LogicManager* GetLogicManager() { return m_logicmgr;}
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_ActuatorEventManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_ACTUATOREVENTMANAGER
diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
index a619eecddd4..9540e3b71f6 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
+++ b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
@@ -41,6 +41,11 @@ public:
virtual void NextFrame();
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_AlwaysEventManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_ALWAYSEVENTMGR
diff --git a/source/gameengine/GameLogic/SCA_EventManager.h b/source/gameengine/GameLogic/SCA_EventManager.h
index 5ff55849bfe..424150ffa63 100644
--- a/source/gameengine/GameLogic/SCA_EventManager.h
+++ b/source/gameengine/GameLogic/SCA_EventManager.h
@@ -71,6 +71,13 @@ public:
protected:
EVENT_MANAGER_TYPE m_mgrtype;
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_EventManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif
diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.h b/source/gameengine/GameLogic/SCA_ExpressionController.h
index 705f6dfc415..4c1dfcb95a2 100644
--- a/source/gameengine/GameLogic/SCA_ExpressionController.h
+++ b/source/gameengine/GameLogic/SCA_ExpressionController.h
@@ -53,6 +53,13 @@ public:
* so that self references are removed before the controller itself is released
*/
virtual void Delete();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_ExpressionController"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_EXPRESSIONCONTROLLER
diff --git a/source/gameengine/GameLogic/SCA_IActuator.h b/source/gameengine/GameLogic/SCA_IActuator.h
index 13c718ee837..00ba8c9ce4e 100644
--- a/source/gameengine/GameLogic/SCA_IActuator.h
+++ b/source/gameengine/GameLogic/SCA_IActuator.h
@@ -127,6 +127,13 @@ public:
void IncLink() { m_links++; }
void DecLink();
bool IsNoLink() const { return !m_links; }
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_IActuator"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_IACTUATOR
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h
index a0d77ed3c03..228d7684b0f 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.h
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.h
@@ -33,6 +33,10 @@
#ifndef KX_INPUTDEVICE_H
#define KX_INPUTDEVICE_H
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
class SCA_InputEvent
{
@@ -302,6 +306,12 @@ public:
*/
virtual void NextFrame();
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_InputEvent"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //KX_INPUTDEVICE_H
diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h
index 79d922a998e..ced9ca94cec 100644
--- a/source/gameengine/GameLogic/SCA_IScene.h
+++ b/source/gameengine/GameLogic/SCA_IScene.h
@@ -33,6 +33,10 @@
#include "STR_String.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
struct SCA_DebugProp
{
class CValue* m_obj;
@@ -60,6 +64,13 @@ public:
void AddDebugProperty(class CValue* debugprop,
const STR_String &name);
void RemoveAllDebugProperties();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_IScene"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_ISCENE_H
diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.h b/source/gameengine/GameLogic/SCA_JoystickManager.h
index d3a7ac95bea..be55e95b033 100644
--- a/source/gameengine/GameLogic/SCA_JoystickManager.h
+++ b/source/gameengine/GameLogic/SCA_JoystickManager.h
@@ -47,6 +47,12 @@ public:
virtual void NextFrame(double curtime,double deltatime);
SCA_Joystick* GetJoystickDevice(short int joyindex);
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_JoystickManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif
diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.h b/source/gameengine/GameLogic/SCA_KeyboardManager.h
index 8f3cc0ab715..c5553a74aef 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardManager.h
+++ b/source/gameengine/GameLogic/SCA_KeyboardManager.h
@@ -56,6 +56,13 @@ public:
virtual void NextFrame();
SCA_IInputDevice* GetInputDevice();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_KeyboardManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_KEYBOARDMANAGER
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index 53e75e1eaee..402090357cb 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -137,6 +137,13 @@ public:
void RegisterGameObj(void* blendobj, CValue* gameobj);
void UnregisterGameObj(void* blendobj, CValue* gameobj);
CValue* FindGameObjByBlendObj(void* blendobj);
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_LogicManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_LOGICMANAGER
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.h b/source/gameengine/GameLogic/SCA_MouseManager.h
index efa4c639ce7..ef1533c636b 100644
--- a/source/gameengine/GameLogic/SCA_MouseManager.h
+++ b/source/gameengine/GameLogic/SCA_MouseManager.h
@@ -63,6 +63,13 @@ public:
bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
virtual void NextFrame();
SCA_IInputDevice* GetInputDevice();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_MouseManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_MOUSEMANAGER
diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.h b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
index f166065b198..011f3285f63 100644
--- a/source/gameengine/GameLogic/SCA_PropertyEventManager.h
+++ b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
@@ -40,6 +40,12 @@ class SCA_PropertyEventManager : public SCA_EventManager
class SCA_LogicManager* m_logicmgr;
public:
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_PropertyEventManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
+
SCA_PropertyEventManager(class SCA_LogicManager* logicmgr);
virtual ~SCA_PropertyEventManager();
virtual void NextFrame();
diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.h b/source/gameengine/GameLogic/SCA_RandomEventManager.h
index 79138c23c62..c8b511b87b7 100644
--- a/source/gameengine/GameLogic/SCA_RandomEventManager.h
+++ b/source/gameengine/GameLogic/SCA_RandomEventManager.h
@@ -45,6 +45,13 @@ public:
SCA_RandomEventManager(class SCA_LogicManager* logicmgr);
virtual void NextFrame();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_RandomEventManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_RANDOMEVENTMGR
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
index 842a0331752..f986fadeaf0 100644
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
+++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
@@ -34,6 +34,10 @@
#ifndef __KX_RANDOMNUMBERGENERATOR
#define __KX_RANDOMNUMBERGENERATOR
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
class SCA_RandomNumberGenerator {
/* reference counted for memleak */
@@ -69,6 +73,13 @@ class SCA_RandomNumberGenerator {
if (--m_refcount == 0)
delete this;
}
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_RandomNumberGenerator"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif /* __KX_RANDOMNUMBERGENERATOR */
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.h b/source/gameengine/GameLogic/SCA_TimeEventManager.h
index bd57e12eb44..089f21e603b 100644
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.h
+++ b/source/gameengine/GameLogic/SCA_TimeEventManager.h
@@ -48,6 +48,13 @@ public:
virtual void RemoveSensor(class SCA_ISensor* sensor);
void AddTimeProperty(CValue* timeval);
void RemoveTimeProperty(CValue* timeval);
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_TimeEventManager"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_TIMEEVENTMANAGER