# OgreMemoryAllocatorConfig.h File Reference

This file configures Ogre's memory allocators. More...

`#include "OgrePrerequisites.h"`
`#include "OgreMemoryAllocatedObject.h"`
`#include "OgreMemorySTLAllocator.h"`
`#include "OgreMemoryNedAlloc.h"`

Go to the source code of this file.

## Namespaces

namespace | Ogre

## Defines

#define | OGRE_MALLOC(bytes, category) ::Ogre::CategorisedAllocPolicy<category>::allocateBytes(bytes)
| Allocate a block of raw memory, and indicate the category of usage.
#define | OGRE_ALLOC_T(T, count, category) static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))
| Allocate a block of memory for a primitive type, and indicate the category of usage.
#define | OGRE_FREE(ptr, category) ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr)
| Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to ensure the matching policy is used.
#define | OGRE_NEW_T(T, category) new (::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T))) T
| Allocate space for one primitive type, external type or non-virtual type with constructor parameters.
#define | OGRE_NEW_ARRAY_T(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count))), count)
| Allocate a block of memory for 'count' primitive types - do not use for classes that inherit from AllocatedObject.
#define | OGRE_DELETE_T(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
| Free the memory allocated with OGRE_NEW_T. Category is required to be restated to ensure the matching policy is used.
#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);}
| Free the memory allocated with OGRE_NEW_ARRAY_T. Category is required to be restated to ensure the matching policy is used, count and type to call destructor.
#define | OGRE_MALLOC_SIMD(bytes, category) ::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(bytes)
| Allocate a block of raw memory aligned to SIMD boundaries, and indicate the category of usage.
#define | OGRE_MALLOC_ALIGN(bytes, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(bytes)
| Allocate a block of raw memory aligned to user defined boundaries, and indicate the category of usage.
#define | OGRE_ALLOC_T_SIMD(T, count, category) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))
| Allocate a block of memory for a primitive type aligned to SIMD boundaries, and indicate the category of usage.
#define | OGRE_ALLOC_T_ALIGN(T, count, category, align) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count)))
| Allocate a block of memory for a primitive type aligned to user defined boundaries, and indicate the category of usage.
#define | OGRE_FREE_SIMD(ptr, category) ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr)
| Free the memory allocated with either OGRE_MALLOC_SIMD or OGRE_ALLOC_T_SIMD. Category is required to be restated to ensure the matching policy is used.
#define | OGRE_FREE_ALIGN(ptr, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr)
| Free the memory allocated with either OGRE_MALLOC_ALIGN or OGRE_ALLOC_T_ALIGN. Category is required to be restated to ensure the matching policy is used.
#define | OGRE_NEW_T_SIMD(T, category) new (::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T))) T
| Allocate space for one primitive type, external type or non-virtual type aligned to SIMD boundaries.
#define | OGRE_NEW_ARRAY_T_SIMD(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count))), count)
| Allocate a block of memory for 'count' primitive types aligned to SIMD boundaries - do not use for classes that inherit from AllocatedObject.
#define | OGRE_DELETE_T_SIMD(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr);}
| Free the memory allocated with OGRE_NEW_T_SIMD. Category is required to be restated to ensure the matching policy is used.
#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);}
| Free the memory allocated with OGRE_NEW_ARRAY_T_SIMD. Category is required to be restated to ensure the matching policy is used, count and type to call destructor.
#define | OGRE_NEW_T_ALIGN(T, category, align) new (::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T))) T
| Allocate space for one primitive type, external type or non-virtual type aligned to user defined boundaries.
#define | OGRE_NEW_ARRAY_T_ALIGN(T, count, category, align) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count))), count)
| Allocate a block of memory for 'count' primitive types aligned to user defined boundaries - do not use for classes that inherit from AllocatedObject.
#define | OGRE_DELETE_T_ALIGN(ptr, T, category, align) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr);}
| Free the memory allocated with OGRE_NEW_T_ALIGN. Category is required to be restated to ensure the matching policy is used.
#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);}
| Free the memory allocated with OGRE_NEW_ARRAY_T_ALIGN. Category is required to be restated to ensure the matching policy is used, count and type to call destructor.
#define | OGRE_NEW new
#define | OGRE_DELETE delete

## Typedefs

typedef CategorisedAllocPolicy< MEMCATEGORY_GENERAL > | GeneralAllocPolicy
typedef CategorisedAllocPolicy< MEMCATEGORY_GEOMETRY > | GeometryAllocPolicy
typedef CategorisedAllocPolicy< MEMCATEGORY_ANIMATION > | AnimationAllocPolicy
typedef CategorisedAllocPolicy< MEMCATEGORY_SCENE_CONTROL > | SceneCtlAllocPolicy
typedef CategorisedAllocPolicy< MEMCATEGORY_SCENE_OBJECTS > | SceneObjAllocPolicy
typedef CategorisedAllocPolicy< MEMCATEGORY_RESOURCE > | ResourceAllocPolicy
typedef CategorisedAllocPolicy< MEMCATEGORY_SCRIPTING > | ScriptingAllocPolicy
typedef CategorisedAllocPolicy< MEMCATEGORY_RENDERSYS > | RenderSysAllocPolicy
typedef AllocatedObject< GeneralAllocPolicy > | GeneralAllocatedObject
typedef AllocatedObject< GeometryAllocPolicy > | GeometryAllocatedObject
typedef AllocatedObject< AnimationAllocPolicy > | AnimationAllocatedObject
typedef AllocatedObject< SceneCtlAllocPolicy > | SceneCtlAllocatedObject
typedef AllocatedObject< SceneObjAllocPolicy > | SceneObjAllocatedObject
typedef AllocatedObject< ResourceAllocPolicy > | ResourceAllocatedObject
typedef AllocatedObject< ScriptingAllocPolicy > | ScriptingAllocatedObject
typedef AllocatedObject< RenderSysAllocPolicy > | RenderSysAllocatedObject
typedef ScriptingAllocatedObject | AbstractNodeAlloc
typedef AnimationAllocatedObject | AnimableAlloc
typedef AnimationAllocatedObject | AnimationAlloc
typedef GeneralAllocatedObject | ArchiveAlloc
typedef GeometryAllocatedObject | BatchedGeometryAlloc
typedef RenderSysAllocatedObject | BufferAlloc
typedef GeneralAllocatedObject | CodecAlloc
typedef ResourceAllocatedObject | CompositorInstAlloc
typedef GeneralAllocatedObject | ConfigAlloc
typedef GeneralAllocatedObject | ControllerAlloc
typedef GeometryAllocatedObject | DebugGeomAlloc
typedef GeneralAllocatedObject | DynLibAlloc
typedef GeometryAllocatedObject | EdgeDataAlloc
typedef GeneralAllocatedObject | FactoryAlloc
typedef SceneObjAllocatedObject | FXAlloc
typedef GeneralAllocatedObject | ImageAlloc
typedef GeometryAllocatedObject | IndexDataAlloc
typedef GeneralAllocatedObject | LogAlloc
typedef SceneObjAllocatedObject | MovableAlloc
typedef SceneCtlAllocatedObject | NodeAlloc
typedef SceneObjAllocatedObject | OverlayAlloc
typedef RenderSysAllocatedObject | GpuParamsAlloc
typedef ResourceAllocatedObject | PassAlloc
typedef GeometryAllocatedObject | PatchAlloc
typedef GeneralAllocatedObject | PluginAlloc
typedef GeneralAllocatedObject | ProfilerAlloc
typedef GeometryAllocatedObject | ProgMeshAlloc
typedef SceneCtlAllocatedObject | RenderQueueAlloc
typedef RenderSysAllocatedObject | RenderSysAlloc
typedef GeneralAllocatedObject | RootAlloc
typedef ResourceAllocatedObject | ResourceAlloc
typedef GeneralAllocatedObject | SerializerAlloc
typedef SceneCtlAllocatedObject | SceneMgtAlloc
typedef ScriptingAllocatedObject | ScriptCompilerAlloc
typedef ScriptingAllocatedObject | ScriptTranslatorAlloc
typedef SceneCtlAllocatedObject | ShadowDataAlloc
typedef GeneralAllocatedObject | StreamAlloc
typedef SceneObjAllocatedObject | SubEntityAlloc
typedef ResourceAllocatedObject | SubMeshAlloc
typedef ResourceAllocatedObject | TechniqueAlloc
typedef GeneralAllocatedObject | TimerAlloc
typedef ResourceAllocatedObject | TextureUnitStateAlloc
typedef GeneralAllocatedObject | UtilityAlloc
typedef GeometryAllocatedObject | VertexDataAlloc
typedef RenderSysAllocatedObject | ViewportAlloc

## Enumerations

enum | MemoryCategory { MEMCATEGORY_GENERAL = 0, MEMCATEGORY_GEOMETRY = 1, MEMCATEGORY_ANIMATION = 2, MEMCATEGORY_SCENE_CONTROL = 3, MEMCATEGORY_SCENE_OBJECTS = 4, MEMCATEGORY_RESOURCE = 5, MEMCATEGORY_SCRIPTING = 6, MEMCATEGORY_RENDERSYS = 7, MEMCATEGORY_COUNT = 8 }
| A set of categories that indicate the purpose of a chunk of memory being allocated. More...

## Functions

template<typename T>
T * | constructN (T *basePtr, size_t count)
| Utility function for constructing an array of objects with placement new, without using new[] (which allocates an undocumented amount of extra memory and so isn't appropriate for custom allocators).

## Detailed Description

This file configures Ogre's memory allocators.

You can modify this file to alter the allocation routines used for Ogre's main objects.

When customising memory allocation, all you need to do is provide one or more custom allocation policy classes. These classes need to implement:

        // Allocate bytes - file/line/func information should be optional,
        // will be provided when available but not everywhere (e.g. release mode, STL allocations)
        static inline void* allocateBytes(size_t count, const char* file = 0, int line = 0, const char* func = 0);
        // Free bytes
        static inline void deallocateBytes(void* ptr);
        // Return the max number of bytes available to be allocated in a single allocation
        static inline size_t getMaxAllocationSize();

Policies are then used as implementations for the wrapper classes and macros which call them. AllocatedObject for example provides the hooks to override the new and delete operators for a class and redirect the functionality to the policy. STLAllocator is a class which is provided to STL containers in order to hook up allocation of the containers members to the allocation policy.

  In addition to linking allocations to policies, this class also defines a number of macros to allow debugging information to be passed along with allocations, such as the file and line number they originate from. It's important to realise that we do not redefine the 'new' and 'delete' symbols with macros, because that's very difficult to consistently do when other libraries are also trying to do the same thing; instead we use dedicated 'OGRE_' prefixed macros. See OGRE_NEW and related items.

  The base macros you can use are listed below, in order of preference and with their conditions stated:
  - OGRE_NEW - use to allocate an object which have custom new/delete operators to handle custom allocations, usually this means it's derived from Ogre::AllocatedObject. Free the memory using OGRE_DELETE. You can in fact use the regular new/delete for these classes but you won't get any line number debugging if you do. The memory category is automatically derived for these classes; for all other allocations you have to specify it.
  - OGRE_NEW_T - use to allocate a single class / struct that does not have custom new/delete operators, either because it is non-virtual (Vector3, Quaternion), or because it is from an external library (e.g. STL). You must deallocate with OGRE_DELETE_T if you expect the destructor to be called. You may free the memory using OGRE_FREE if you are absolutely sure there is no destructor to be called. These macros ensure that constructors and destructors are called correctly even though the memory originates externally (via placement new). Also note that you have to specify the type and memory category so that the correct allocator can be derived, when both allocating and freeing.
  - OGRE_NEW_ARRAY_T - as OGRE_NEW_T except with an extra parameter to construct multiple instances in contiguous memory. Again constructors and destructors are called. Free with OGRE_DELETE_ARRAY_T.
  - OGRE_ALLOC_T - use to allocate a set of primitive types conveniently with type safety. This can also be used for classes and structs but it is imperative that you understand that neither the constructor nor the destructor will be called. Sometimes you want this because it's more efficient just to grab/free a chunk of memory without having to iterate over each element constructing / destructing. Free the memory with OGRE_FREE.
  - OGRE_MALLOC - the most raw form of allocation, just a set of bytes. Use OGRE_FREE to release.
  - _SIMD and _ALIGN variants - all of the above have variations which allow aligned memory allocations. The _SIMD versions align automatically to the SIMD requirements of your platform, the _ALIGN variants allow user-defined alignment to be specified.
  Here are some examples:

          AllocatedClass* obj = OGRE_NEW AllocatedClass();
          OGRE_DELETE obj;
          AllocatedClass* array = OGRE_NEW AllocatedClass[10];
          OGRE_DELETE [] obj;
          ExternalClass* obj = OGRE_NEW_T(ExternalClass, MEMCATEGORY_GENERAL)(constructorArgs);
          OGRE_DELETE_T(obj, ExternalClass, MEMCATEGORY_GENERAL);
          ExternalClass* obj = OGRE_NEW_ARRAY_T(ExternalClass, 10, MEMCATEGORY_GENERAL);
          OGRE_DELETE_ARRAY_T(obj, NonVirtualClass, 10, MEMCATEGORY_GENERAL);
          long* pLong = OGRE_ALLOC_T(long, 10, MEMCATEGORY_GENERAL);
          OGRE_FREE(pLong, MEMCATEGORY_GENERAL);
          long* pLong = OGRE_NEW_T(long, MEMCATEGORY_GENERAL)(0);
          OGRE_FREE(pLong, MEMCATEGORY_GENERAL);
          void* pVoid = OGRE_MALLOC(1024, MEMCATEGORY_GENERAL);
          OGRE_FREE(pVoid, MEMCATEGORY_GENERAL);

  OGRE_ALLOC_T is also the route to go for allocating real primitive types like int & float. You free the memory using OGRE_FREE, and both variants have SIMD and custom alignment variants.

Definition in file OgreMemoryAllocatorConfig.h.

## Define Documentation

#define OGRE_ALLOC_T | ( | T,
|  | count,
|  | category |  | ) | static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))

| Allocate a block of memory for a primitive type, and indicate the category of usage. Definition at line 376 of file OgreMemoryAllocatorConfig.h. Referenced by Ogre::AxisAlignedBox::getAllCorners(), and Ogre::VertexCacheProfiler::VertexCacheProfiler().

#define OGRE_ALLOC_T_ALIGN | ( | T,
|  | count,
|  | category,
|  | align |  | ) | static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count)))

| Allocate a block of memory for a primitive type aligned to user defined boundaries, and indicate the category of usage. Definition at line 397 of file OgreMemoryAllocatorConfig.h.

#define OGRE_ALLOC_T_SIMD | ( | T,
|  | count,
|  | category |  | ) | static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))

| Allocate a block of memory for a primitive type aligned to SIMD boundaries, and indicate the category of usage. Definition at line 395 of file OgreMemoryAllocatorConfig.h.

#define OGRE_DELETE delete

| Definition at line 422 of file OgreMemoryAllocatorConfig.h. Referenced by Ogre::RenderQueueGroup::clear(), Ogre::SharedPtr< Skeleton >::destroy(), Ogre::ZipArchiveFactory::destroyInstance(), Ogre::StaticGeometry::OptimisedSubMeshGeometry::~OptimisedSubMeshGeometry(), and Ogre::RenderQueueGroup::~RenderQueueGroup().

#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);}

| Free the memory allocated with OGRE_NEW_ARRAY_T. Category is required to be restated to ensure the matching policy is used, count and type to call destructor. Definition at line 387 of file OgreMemoryAllocatorConfig.h.

#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);}

| Free the memory allocated with OGRE_NEW_ARRAY_T_ALIGN. Category is required to be restated to ensure the matching policy is used, count and type to call destructor. Definition at line 418 of file OgreMemoryAllocatorConfig.h.

#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);}

| Free the memory allocated with OGRE_NEW_ARRAY_T_SIMD. Category is required to be restated to ensure the matching policy is used, count and type to call destructor. Definition at line 410 of file OgreMemoryAllocatorConfig.h.

#define OGRE_DELETE_T | ( | ptr,
|  | T,
|  | category |  | ) | if(ptr){(ptr)->~T(); ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}

| Free the memory allocated with OGRE_NEW_T. Category is required to be restated to ensure the matching policy is used. Definition at line 385 of file OgreMemoryAllocatorConfig.h. Referenced by Ogre::SharedPtr< Skeleton >::destroy(), and Ogre::Any::~Any().

#define OGRE_DELETE_T_ALIGN | ( | ptr,
|  | T,
|  | category,
|  | align |  | ) | if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr);}

| Free the memory allocated with OGRE_NEW_T_ALIGN. Category is required to be restated to ensure the matching policy is used. Definition at line 416 of file OgreMemoryAllocatorConfig.h.

#define OGRE_DELETE_T_SIMD | ( | ptr,
|  | T,
|  | category |  | ) | if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr);}

| Free the memory allocated with OGRE_NEW_T_SIMD. Category is required to be restated to ensure the matching policy is used. Definition at line 408 of file OgreMemoryAllocatorConfig.h.

#define OGRE_FREE | ( | ptr,
|  | category |  | ) | ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr)

| Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to ensure the matching policy is used. Definition at line 378 of file OgreMemoryAllocatorConfig.h. Referenced by Ogre::SharedPtr< Skeleton >::destroy(), Ogre::AxisAlignedBox::~AxisAlignedBox(), and Ogre::VertexCacheProfiler::~VertexCacheProfiler().

#define OGRE_FREE_ALIGN | ( | ptr,
|  | category,
|  | align |  | ) | ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr)

| Free the memory allocated with either OGRE_MALLOC_ALIGN or OGRE_ALLOC_T_ALIGN. Category is required to be restated to ensure the matching policy is used. Definition at line 401 of file OgreMemoryAllocatorConfig.h.

#define OGRE_FREE_SIMD | ( | ptr,
|  | category |  | ) | ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr)

| Free the memory allocated with either OGRE_MALLOC_SIMD or OGRE_ALLOC_T_SIMD. Category is required to be restated to ensure the matching policy is used. Definition at line 399 of file OgreMemoryAllocatorConfig.h.

#define OGRE_MALLOC | ( | bytes,
|  | category |  | ) | ::Ogre::CategorisedAllocPolicy<category>::allocateBytes(bytes)

| Allocate a block of raw memory, and indicate the category of usage. Definition at line 374 of file OgreMemoryAllocatorConfig.h.

#define OGRE_MALLOC_ALIGN | ( | bytes,
|  | category,
|  | align |  | ) | ::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(bytes)

| Allocate a block of raw memory aligned to user defined boundaries, and indicate the category of usage. Definition at line 393 of file OgreMemoryAllocatorConfig.h.

#define OGRE_MALLOC_SIMD | ( | bytes,
|  | category |  | ) | ::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(bytes)

| Allocate a block of raw memory aligned to SIMD boundaries, and indicate the category of usage. Definition at line 391 of file OgreMemoryAllocatorConfig.h.

#define OGRE_NEW new

Definition at line 421 of file OgreMemoryAllocatorConfig.h.

Referenced by Ogre::RenderQueueGroup::addRenderable(), Ogre::SceneManager::createAutoParamDataSource(), Ogre::ZipArchiveFactory::createInstance(), Ogre::FileSystemArchiveFactory::createInstance(), Ogre::TextAreaOverlayElementFactory::createOverlayElement(), Ogre::BorderPanelOverlayElementFactory::createOverlayElement(), and Ogre::PanelOverlayElementFactory::createOverlayElement().

#define OGRE_NEW_ARRAY_T | ( | T,
|  | count,
|  | category |  | ) | ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count))), count)

| Allocate a block of memory for 'count' primitive types - do not use for classes that inherit from AllocatedObject. Definition at line 383 of file OgreMemoryAllocatorConfig.h.

#define OGRE_NEW_ARRAY_T_ALIGN | ( | T,
|  | count,
|  | category,
|  | align |  | ) | ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count))), count)

| Allocate a block of memory for 'count' primitive types aligned to user defined boundaries - do not use for classes that inherit from AllocatedObject. Definition at line 414 of file OgreMemoryAllocatorConfig.h.

#define OGRE_NEW_ARRAY_T_SIMD | ( | T,
|  | count,
|  | category |  | ) | ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count))), count)

| Allocate a block of memory for 'count' primitive types aligned to SIMD boundaries - do not use for classes that inherit from AllocatedObject. Definition at line 406 of file OgreMemoryAllocatorConfig.h.

#define OGRE_NEW_T | ( | T,
|  | category |  | ) | new (::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T))) T

Allocate space for one primitive type, external type or non-virtual type with constructor parameters.

Definition at line 381 of file OgreMemoryAllocatorConfig.h.

Referenced by Ogre::AnyNumeric::numholder< ValueType >::add(), Ogre::AnyNumeric::AnyNumeric(), Ogre::SharedPtr< Skeleton >::bind(), Ogre::AnyNumeric::numholder< ValueType >::clone(), Ogre::Any::holder< ValueType >::clone(), Ogre::AnyNumeric::numholder< ValueType >::divide(), Ogre::AnyNumeric::numholder< ValueType >::multiply(), and Ogre::AnyNumeric::numholder< ValueType >::subtract().

#define OGRE_NEW_T_ALIGN | ( | T,
|  | category,
|  | align |  | ) | new (::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T))) T

| Allocate space for one primitive type, external type or non-virtual type aligned to user defined boundaries. Definition at line 412 of file OgreMemoryAllocatorConfig.h.

#define OGRE_NEW_T_SIMD | ( | T,
|  | category |  | ) | new (::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T))) T

| Allocate space for one primitive type, external type or non-virtual type aligned to SIMD boundaries. Definition at line 404 of file OgreMemoryAllocatorConfig.h.

## Typedef Documentation

typedef ScriptingAllocatedObject Ogre::AbstractNodeAlloc

| Definition at line 241 of file OgreMemoryAllocatorConfig.h.

typedef AnimationAllocatedObject Ogre::AnimableAlloc

| Definition at line 242 of file OgreMemoryAllocatorConfig.h.

typedef AnimationAllocatedObject Ogre::AnimationAlloc

| Definition at line 243 of file OgreMemoryAllocatorConfig.h.

typedef AllocatedObject<AnimationAllocPolicy> Ogre::AnimationAllocatedObject

| Definition at line 229 of file OgreMemoryAllocatorConfig.h.

typedef CategorisedAllocPolicy<MEMCATEGORY_ANIMATION> Ogre::AnimationAllocPolicy

| Definition at line 219 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::ArchiveAlloc

| Definition at line 244 of file OgreMemoryAllocatorConfig.h.

typedef GeometryAllocatedObject Ogre::BatchedGeometryAlloc

| Definition at line 245 of file OgreMemoryAllocatorConfig.h.

typedef RenderSysAllocatedObject Ogre::BufferAlloc

| Definition at line 246 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::CodecAlloc

| Definition at line 247 of file OgreMemoryAllocatorConfig.h.

typedef ResourceAllocatedObject Ogre::CompositorInstAlloc

| Definition at line 248 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::ConfigAlloc

| Definition at line 249 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::ControllerAlloc

| Definition at line 250 of file OgreMemoryAllocatorConfig.h.

typedef GeometryAllocatedObject Ogre::DebugGeomAlloc

| Definition at line 251 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::DynLibAlloc

| Definition at line 252 of file OgreMemoryAllocatorConfig.h.

typedef GeometryAllocatedObject Ogre::EdgeDataAlloc

| Definition at line 253 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::FactoryAlloc

| Definition at line 254 of file OgreMemoryAllocatorConfig.h.

typedef SceneObjAllocatedObject Ogre::FXAlloc

| Definition at line 255 of file OgreMemoryAllocatorConfig.h.

typedef AllocatedObject<GeneralAllocPolicy> Ogre::GeneralAllocatedObject

| Definition at line 227 of file OgreMemoryAllocatorConfig.h.

typedef CategorisedAllocPolicy<MEMCATEGORY_GENERAL> Ogre::GeneralAllocPolicy

| Definition at line 217 of file OgreMemoryAllocatorConfig.h.

typedef AllocatedObject<GeometryAllocPolicy> Ogre::GeometryAllocatedObject

| Definition at line 228 of file OgreMemoryAllocatorConfig.h.

typedef CategorisedAllocPolicy<MEMCATEGORY_GEOMETRY> Ogre::GeometryAllocPolicy

| Definition at line 218 of file OgreMemoryAllocatorConfig.h.

typedef RenderSysAllocatedObject Ogre::GpuParamsAlloc

| Definition at line 262 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::ImageAlloc

| Definition at line 256 of file OgreMemoryAllocatorConfig.h.

typedef GeometryAllocatedObject Ogre::IndexDataAlloc

| Definition at line 257 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::LogAlloc

| Definition at line 258 of file OgreMemoryAllocatorConfig.h.

typedef SceneObjAllocatedObject Ogre::MovableAlloc

| Definition at line 259 of file OgreMemoryAllocatorConfig.h.

typedef SceneCtlAllocatedObject Ogre::NodeAlloc

| Definition at line 260 of file OgreMemoryAllocatorConfig.h.

typedef SceneObjAllocatedObject Ogre::OverlayAlloc

| Definition at line 261 of file OgreMemoryAllocatorConfig.h.

typedef ResourceAllocatedObject Ogre::PassAlloc

| Definition at line 263 of file OgreMemoryAllocatorConfig.h.

typedef GeometryAllocatedObject Ogre::PatchAlloc

| Definition at line 264 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::PluginAlloc

| Definition at line 265 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::ProfilerAlloc

| Definition at line 266 of file OgreMemoryAllocatorConfig.h.

typedef GeometryAllocatedObject Ogre::ProgMeshAlloc

| Definition at line 267 of file OgreMemoryAllocatorConfig.h.

typedef SceneCtlAllocatedObject Ogre::RenderQueueAlloc

| Definition at line 268 of file OgreMemoryAllocatorConfig.h.

typedef RenderSysAllocatedObject Ogre::RenderSysAlloc

| Definition at line 269 of file OgreMemoryAllocatorConfig.h.

typedef AllocatedObject<RenderSysAllocPolicy> Ogre::RenderSysAllocatedObject

| Definition at line 234 of file OgreMemoryAllocatorConfig.h.

typedef CategorisedAllocPolicy<MEMCATEGORY_RENDERSYS> Ogre::RenderSysAllocPolicy

| Definition at line 224 of file OgreMemoryAllocatorConfig.h.

typedef ResourceAllocatedObject Ogre::ResourceAlloc

| Definition at line 271 of file OgreMemoryAllocatorConfig.h.

typedef AllocatedObject<ResourceAllocPolicy> Ogre::ResourceAllocatedObject

| Definition at line 232 of file OgreMemoryAllocatorConfig.h.

typedef CategorisedAllocPolicy<MEMCATEGORY_RESOURCE> Ogre::ResourceAllocPolicy

| Definition at line 222 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::RootAlloc

| Definition at line 270 of file OgreMemoryAllocatorConfig.h.

typedef AllocatedObject<SceneCtlAllocPolicy> Ogre::SceneCtlAllocatedObject

| Definition at line 230 of file OgreMemoryAllocatorConfig.h.

typedef CategorisedAllocPolicy<MEMCATEGORY_SCENE_CONTROL> Ogre::SceneCtlAllocPolicy

| Definition at line 220 of file OgreMemoryAllocatorConfig.h.

typedef SceneCtlAllocatedObject Ogre::SceneMgtAlloc

| Definition at line 273 of file OgreMemoryAllocatorConfig.h.

typedef AllocatedObject<SceneObjAllocPolicy> Ogre::SceneObjAllocatedObject

| Definition at line 231 of file OgreMemoryAllocatorConfig.h.

typedef CategorisedAllocPolicy<MEMCATEGORY_SCENE_OBJECTS> Ogre::SceneObjAllocPolicy

| Definition at line 221 of file OgreMemoryAllocatorConfig.h.

typedef ScriptingAllocatedObject Ogre::ScriptCompilerAlloc

| Definition at line 274 of file OgreMemoryAllocatorConfig.h.

typedef AllocatedObject<ScriptingAllocPolicy> Ogre::ScriptingAllocatedObject

| Definition at line 233 of file OgreMemoryAllocatorConfig.h.

typedef CategorisedAllocPolicy<MEMCATEGORY_SCRIPTING> Ogre::ScriptingAllocPolicy

| Definition at line 223 of file OgreMemoryAllocatorConfig.h.

typedef ScriptingAllocatedObject Ogre::ScriptTranslatorAlloc

| Definition at line 275 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::SerializerAlloc

| Definition at line 272 of file OgreMemoryAllocatorConfig.h.

typedef SceneCtlAllocatedObject Ogre::ShadowDataAlloc

| Definition at line 276 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::StreamAlloc

| Definition at line 277 of file OgreMemoryAllocatorConfig.h.

typedef SceneObjAllocatedObject Ogre::SubEntityAlloc

| Definition at line 278 of file OgreMemoryAllocatorConfig.h.

typedef ResourceAllocatedObject Ogre::SubMeshAlloc

| Definition at line 279 of file OgreMemoryAllocatorConfig.h.

typedef ResourceAllocatedObject Ogre::TechniqueAlloc

| Definition at line 280 of file OgreMemoryAllocatorConfig.h.

typedef ResourceAllocatedObject Ogre::TextureUnitStateAlloc

| Definition at line 282 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::TimerAlloc

| Definition at line 281 of file OgreMemoryAllocatorConfig.h.

typedef GeneralAllocatedObject Ogre::UtilityAlloc

| Definition at line 283 of file OgreMemoryAllocatorConfig.h.

typedef GeometryAllocatedObject Ogre::VertexDataAlloc

| Definition at line 284 of file OgreMemoryAllocatorConfig.h.

typedef RenderSysAllocatedObject Ogre::ViewportAlloc

| Definition at line 285 of file OgreMemoryAllocatorConfig.h.

## Enumeration Type Documentation

enum Ogre::MemoryCategory

A set of categories that indicate the purpose of a chunk of memory being allocated.

These categories will be provided at allocation time in order to allow the allocation policy to vary its behaviour if it wishes. This allows you to use a single policy but still have variant behaviour. The level of control it gives you is at a higher level than assigning different policies to different classes, but is the only control you have over general allocations that are primitive types.

Enumeration values:

  MEMCATEGORY_GENERAL | General purpose.
  MEMCATEGORY_GEOMETRY | Geometry held in main memory.
  MEMCATEGORY_ANIMATION | Animation data like tracks, bone matrices.
  MEMCATEGORY_SCENE_CONTROL | Nodes, control data.
  MEMCATEGORY_SCENE_OBJECTS | Scene object instances.
  MEMCATEGORY_RESOURCE | Other resources.
  MEMCATEGORY_SCRIPTING | Scripting.
  MEMCATEGORY_RENDERSYS | Rendersystem structures.
  MEMCATEGORY_COUNT |

Definition at line 144 of file OgreMemoryAllocatorConfig.h.

## Function Documentation

template<typename T>
T* Ogre::constructN | ( | T * | basePtr,
|  | size_t | count
| ) |

| Utility function for constructing an array of objects with placement new, without using new[] (which allocates an undocumented amount of extra memory and so isn't appropriate for custom allocators). Definition at line 304 of file OgreMemoryAllocatorConfig.h.

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat Apr 11 13:46:44 2009