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/BlenderRoutines
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/BlenderRoutines')
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.h11
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h10
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h11
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h11
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h11
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderSystem.h12
6 files changed, 65 insertions, 1 deletions
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
index fd41fb90f2f..d49c877f610 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
@@ -40,6 +40,10 @@
#include "KX_BlenderGL.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
struct ARegion;
struct wmWindow;
@@ -166,6 +170,13 @@ private:
struct ARegion* m_ar;
struct wmWindow* m_win;
RAS_Rect m_area_rect;
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderCanvas"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif // __KX_BLENDERCANVAS
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
index 32391e63264..d4dd9af3d4f 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
@@ -39,7 +39,9 @@
#include "WM_types.h"
#include "SCA_IInputDevice.h"
-
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
/**
Base Class for Blender specific inputdevices. Blender specific inputdevices are used when the gameengine is running in embedded mode instead of standalone mode.
@@ -222,6 +224,12 @@ public:
// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
virtual bool ConvertBlenderEvent(unsigned short incode,short val)=0;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderInputDevice"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_BLENDERINPUTDEVICE
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
index 5bf37acf236..c801322e787 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
@@ -31,6 +31,10 @@
#include "KX_BlenderInputDevice.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
class KX_BlenderKeyboardDevice : public BL_BlenderInputDevice
{
bool m_hookesc;
@@ -43,6 +47,13 @@ public:
virtual bool ConvertBlenderEvent(unsigned short incode,short val);
virtual void NextFrame();
virtual void HookEscape();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderKeyboardDevice"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_BLENDERKEYBOARDDEVICE
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h
index 2f9e956a1d8..92383e4b533 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h
@@ -31,6 +31,10 @@
#include "KX_BlenderInputDevice.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
class KX_BlenderMouseDevice : public BL_BlenderInputDevice
{
public:
@@ -41,6 +45,13 @@ public:
// virtual const SCA_InputEvent& GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode);
virtual bool ConvertBlenderEvent(unsigned short incode,short val);
virtual void NextFrame();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderMouseDevice"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_BLENDERMOUSEDEVICE
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
index 60130e6bfc9..70672b8350b 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
@@ -37,6 +37,10 @@
#include "RAS_IRenderTools.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
struct KX_ClientObjectInfo;
class KX_RayCast;
@@ -95,6 +99,13 @@ public:
virtual void Render2DFilters(RAS_ICanvas* canvas);
virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj);
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderRenderTools"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_BLENDERRENDERTOOLS
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h b/source/gameengine/BlenderRoutines/KX_BlenderSystem.h
index d99bb9b14a8..b6b2841e81c 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderSystem.h
@@ -34,6 +34,10 @@
*/
#include "KX_ISystem.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
class KX_BlenderSystem : public KX_ISystem
{
double m_starttime;
@@ -42,6 +46,14 @@ public:
KX_BlenderSystem();
virtual ~KX_BlenderSystem() {};
virtual double GetTimeInSeconds();
+
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+ void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderSystem"); }
+ void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
};
#endif //__KX_BLENDERSYSTEM