This file defines a template class which implements a kind of a custom memory management. It is used to be notably faster for classes for which lots of objects (of the same size) are made.
Definition in file custmem.hpp.
Go to the source code of this file.
Defines | |
#define | INTELIB_CUSTOM_MEMORY_MANAGEMENT 1 |
Set to 1 to use the custom memory management, 0 to disable it. | |
#define | INTELIB_CMM_MAX_MEM_BLOCK (256*1024) |
#define | INTELIB_DECLARE_CUSTOM_MEMORY_MANAGEMENT(classname) |
Macro to easily make any class to be allocated on a custom manner. | |
#define | INTELIB_IMPLEMENT_CUSTOM_MEMORY_MANAGEMENT(classname) |
Implementation of a custom memory management. | |
Typedefs | |
typedef unsigned int | size_t |
|
Set to 1 to use the custom memory management, 0 to disable it.
Definition at line 30 of file custmem.hpp. |
|
Definition at line 36 of file custmem.hpp. |
|
Value: private: \ static class classname##MemoryManager TheMemoryManager; \ public: \ void* operator new(size_t s); \ void operator delete(void *p, size_t s); Just call this macro within the class definition
Definition at line 118 of file custmem.hpp. |
|
Value: class classname##MemoryManager : \ public CustomMemoryManager<sizeof (classname), \ INTELIB_CMM_MAX_MEM_BLOCK / sizeof(classname)> {} \ classname::TheMemoryManager; \ void* classname::operator new(size_t s) \ { return TheMemoryManager.GetUnit(s); } \ void classname::operator delete(void *p, size_t s) \ { return TheMemoryManager.ReleaseUnit(p, s); } This macro is to be inserted into the .cpp file along with the class definition for every class which is made to be allocated on the custom manner with the INTELIB_DECLARE_CUSTOM_MEMORY_MANAGEMENT macro Definition at line 131 of file custmem.hpp. |
|
Definition at line 43 of file custmem.hpp. |