Go to the documentation of this file.
29 #ifndef __MemoryAllocatorConfig_H__
30 #define __MemoryAllocatorConfig_H__
190 #if OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_NEDPOOLING
205 #elif OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_NED
216 template <MemoryCategory Cat>
class CategorisedAllocPolicy :
public NedAllocPolicy{};
217 template <MemoryCategory Cat,
size_t align = 0>
class CategorisedAlignAllocPolicy :
public NedAlignedAllocPolicy<align>{};
220 #elif OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_STD
231 template <MemoryCategory Cat>
class CategorisedAllocPolicy :
public StdAllocPolicy{};
232 template <MemoryCategory Cat,
size_t align = 0>
class CategorisedAlignAllocPolicy :
public StdAlignedAllocPolicy<align>{};
348 for (
size_t i = 0; i < count; ++i)
350 new ((
void*)(basePtr+i)) T();
370 # define OGRE_MALLOC(bytes, category) ::Ogre::CategorisedAllocPolicy<category>::allocateBytes(bytes, __FILE__, __LINE__, __FUNCTION__)
371 # define OGRE_ALLOC_T(T, count, category) static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__))
373 # define OGRE_FREE(ptr, category) ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr)
377 # define OGRE_NEW_T(T, category) new (::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T), __FILE__, __LINE__, __FUNCTION__)) T
378 # define OGRE_NEW_ARRAY_T(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__)), count)
380 # define OGRE_DELETE_T(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
382 # define OGRE_DELETE_ARRAY_T(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
387 # define OGRE_MALLOC_SIMD(bytes, category) ::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(bytes, __FILE__, __LINE__, __FUNCTION__)
388 # define OGRE_MALLOC_ALIGN(bytes, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(bytes, __FILE__, __LINE__, __FUNCTION__)
390 # define OGRE_ALLOC_T_SIMD(T, count, category) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__))
392 # define OGRE_ALLOC_T_ALIGN(T, count, category, align) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__))
394 # define OGRE_FREE_SIMD(ptr, category) ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes(ptr)
396 # define OGRE_FREE_ALIGN(ptr, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes(ptr)
400 # define OGRE_NEW_T_SIMD(T, category) new (::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T), __FILE__, __LINE__, __FUNCTION__)) T
401 # define OGRE_NEW_ARRAY_T_SIMD(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__)), count)
403 # define OGRE_DELETE_T_SIMD(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes(ptr);}
405 # define OGRE_DELETE_ARRAY_T_SIMD(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes(ptr);}
407 # define OGRE_NEW_T_ALIGN(T, category, align) new (::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T), __FILE__, __LINE__, __FUNCTION__)) T
409 # define OGRE_NEW_ARRAY_T_ALIGN(T, count, category, align) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__)), count)
411 # define OGRE_DELETE_T_ALIGN(ptr, T, category, align) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes(ptr);}
413 # define OGRE_DELETE_ARRAY_T_ALIGN(ptr, T, count, category, align) if(ptr){for (size_t _b = 0; _b < count; ++_b) { (ptr)[_b].~T();} ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes(ptr);}
419 # define OGRE_NEW new (__FILE__, __LINE__, __FUNCTION__)
420 # define OGRE_DELETE delete
423 #else // !OGRE_DEBUG_MODE
426 # define OGRE_MALLOC(bytes, category) ::Ogre::CategorisedAllocPolicy<category>::allocateBytes(bytes)
427 # define OGRE_ALLOC_T(T, count, category) static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))
429 # define OGRE_FREE(ptr, category) ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr)
433 # define OGRE_NEW_T(T, category) new (::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T))) T
434 # define OGRE_NEW_ARRAY_T(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count))), count)
436 # define OGRE_DELETE_T(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
438 # define OGRE_DELETE_ARRAY_T(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
443 # define OGRE_MALLOC_SIMD(bytes, category) ::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(bytes)
444 # define OGRE_MALLOC_ALIGN(bytes, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(bytes)
446 # define OGRE_ALLOC_T_SIMD(T, count, category) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))
448 # define OGRE_ALLOC_T_ALIGN(T, count, category, align) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count)))
450 # define OGRE_FREE_SIMD(ptr, category) ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr)
452 # define OGRE_FREE_ALIGN(ptr, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr)
456 # define OGRE_NEW_T_SIMD(T, category) new (::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T))) T
457 # define OGRE_NEW_ARRAY_T_SIMD(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count))), count)
459 # define OGRE_DELETE_T_SIMD(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr);}
461 # define OGRE_DELETE_ARRAY_T_SIMD(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr);}
463 # define OGRE_NEW_T_ALIGN(T, category, align) new (::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T))) T
465 # define OGRE_NEW_ARRAY_T_ALIGN(T, count, category, align) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count))), count)
467 # define OGRE_DELETE_T_ALIGN(ptr, T, category, align) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr);}
469 # define OGRE_DELETE_ARRAY_T_ALIGN(ptr, T, count, category, align) if(ptr){for (size_t _b = 0; _b < count; ++_b) { (ptr)[_b].~T();} ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr);}
473 # define OGRE_NEW new
474 # define OGRE_DELETE delete
476 #endif // OGRE_DEBUG_MODE
RenderSysAllocatedObject GpuParamsAlloc
@ MEMCATEGORY_SCENE_OBJECTS
Scene object instances.
GeneralAllocatedObject FactoryAlloc
GeneralAllocatedObject UtilityAlloc
@ MEMCATEGORY_GEOMETRY
Geometry held in main memory.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
GeneralAllocatedObject LogAlloc
AnimationAllocatedObject AnimationAlloc
ResourceAllocatedObject TechniqueAlloc
SceneCtlAllocatedObject RenderQueueAlloc
SceneCtlAllocatedObject LodAlloc
GeneralAllocatedObject ConfigAlloc
GeneralAllocatedObject StreamAlloc
CategorisedAllocPolicy< Ogre::MEMCATEGORY_SCENE_CONTROL > SceneCtlAllocPolicy
GeneralAllocatedObject DynLibAlloc
SceneObjAllocatedObject MovableAlloc
GeneralAllocatedObject RootAlloc
GeometryAllocatedObject IndexDataAlloc
CategorisedAllocPolicy< Ogre::MEMCATEGORY_GENERAL > GeneralAllocPolicy
ScriptingAllocatedObject ScriptTranslatorAlloc
CategorisedAllocPolicy< Ogre::MEMCATEGORY_GEOMETRY > GeometryAllocPolicy
ScriptingAllocatedObject ScriptCompilerAlloc
@ MEMCATEGORY_RENDERSYS
Rendersystem structures.
CategorisedAllocPolicy< Ogre::MEMCATEGORY_SCENE_OBJECTS > SceneObjAllocPolicy
GeneralAllocatedObject ArchiveAlloc
AllocatedObject< AnimationAllocPolicy > AnimationAllocatedObject
@ MEMCATEGORY_ANIMATION
Animation data like tracks, bone matrices.
AllocatedObject< GeneralAllocPolicy > GeneralAllocatedObject
CategorisedAllocPolicy< Ogre::MEMCATEGORY_RENDERSYS > RenderSysAllocPolicy
GeneralAllocatedObject ProfilerAlloc
AllocatedObject< GeometryAllocPolicy > GeometryAllocatedObject
An allocation policy for use with AllocatedObject and STLAllocator, which aligns memory at a given bo...
An allocation policy for use with AllocatedObject and STLAllocator.
void deletePtr(T *ptr)
Function which invokes OGRE_DELETE on a given pointer.
ScriptingAllocatedObject AbstractNodeAlloc
SceneObjAllocatedObject FXAlloc
ResourceAllocatedObject ResourceAlloc
GeneralAllocatedObject ImageAlloc
GeneralAllocatedObject TimerAlloc
GeometryAllocatedObject PatchAlloc
@ MEMCATEGORY_GENERAL
General purpose.
SceneObjAllocatedObject OverlayAlloc
ResourceAllocatedObject CompositorInstAlloc
GeneralAllocatedObject CodecAlloc
@ MEMCATEGORY_SCENE_CONTROL
Nodes, control data.
AllocatedObject< ScriptingAllocPolicy > ScriptingAllocatedObject
GeometryAllocatedObject VertexDataAlloc
AllocatedObject< RenderSysAllocPolicy > RenderSysAllocatedObject
RenderSysAllocatedObject RenderSysAlloc
T * constructN(T *basePtr, size_t count)
Utility function for constructing an array of objects with placement new, without using new[] (which ...
AnimationAllocatedObject AnimableAlloc
SceneCtlAllocatedObject NodeAlloc
RenderSysAllocatedObject ViewportAlloc
GeneralAllocatedObject PluginAlloc
CategorisedAllocPolicy< Ogre::MEMCATEGORY_SCRIPTING > ScriptingAllocPolicy
AllocatedObject< ResourceAllocPolicy > ResourceAllocatedObject
GeneralAllocatedObject FileSystemLayerAlloc
GeometryAllocatedObject DebugGeomAlloc
GeneralAllocatedObject SerializerAlloc
MemoryCategory
A set of categories that indicate the purpose of a chunk of memory being allocated.
AllocatedObject< SceneObjAllocPolicy > SceneObjAllocatedObject
GeometryAllocatedObject EdgeDataAlloc
@ MEMCATEGORY_RESOURCE
Other resources.
@ MEMCATEGORY_SCRIPTING
Scripting.
GeometryAllocatedObject BatchedGeometryAlloc
ResourceAllocatedObject PassAlloc
GeneralAllocatedObject ControllerAlloc
ResourceAllocatedObject SubMeshAlloc
ResourceAllocatedObject TextureUnitStateAlloc
GeometryAllocatedObject ProgMeshAlloc
CategorisedAllocPolicy< Ogre::MEMCATEGORY_ANIMATION > AnimationAllocPolicy
CategorisedAllocPolicy< Ogre::MEMCATEGORY_RESOURCE > ResourceAllocPolicy
SceneObjAllocatedObject SubEntityAlloc
RenderSysAllocatedObject BufferAlloc
SceneCtlAllocatedObject ShadowDataAlloc
AllocatedObject< SceneCtlAllocPolicy > SceneCtlAllocatedObject
SceneCtlAllocatedObject SceneMgtAlloc
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.