OGRE  1.10.12
Object-Oriented Graphics Rendering Engine
Memory

Files

file  OgreMemoryAllocatorConfig.h
 This file configures Ogre's memory allocators.
 

Namespaces

 Ogre
 

This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/

 

Classes

class  Ogre::AlignedMemory
 Class to provide aligned memory allocate functionality. More...
 
class  Ogre::AllocatedObject< Alloc >
 Superclass for all objects that wish to use custom memory allocators when their new / delete operators are called. More...
 
class  Ogre::STLAllocator< T, AllocPolicy >
 
struct  Ogre::STLAllocatorBase< T >
 Wrapper class for operating as an STL container allocator. More...
 
struct  Ogre::STLAllocatorBase< const T >
 

Macros

#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. More...
 
#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. More...
 
#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. More...
 
#define OGRE_DELETE   delete
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#define OGRE_MALLOC(bytes, category)   ::Ogre::CategorisedAllocPolicy<category>::allocateBytes(bytes)
 Allocate a block of raw memory, and indicate the category of usage. More...
 
#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. More...
 
#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. More...
 
#define OGRE_NEW   new
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 
#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. More...
 

Enumerations

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

Functions

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). More...
 
template<typename T , typename T2 , typename P >
bool Ogre::operator!= (STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
 determine equality, can memory from another allocator be released by this allocator, (ISO C++) More...
 
template<typename T , typename P , typename OtherAllocator >
bool Ogre::operator!= (STLAllocator< T, P > const &, OtherAllocator const &)
 determine equality, can memory from another allocator be released by this allocator, (ISO C++) More...
 
template<typename T , typename T2 , typename P >
bool Ogre::operator== (STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
 determine equality, can memory from another allocator be released by this allocator, (ISO C++) More...
 
template<typename T , typename P , typename OtherAllocator >
bool Ogre::operator== (STLAllocator< T, P > const &, OtherAllocator const &)
 determine equality, can memory from another allocator be released by this allocator, (ISO C++) More...
 

Detailed Description

Macro Definition Documentation

◆ OGRE_MALLOC

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

Allocate a block of raw memory, and indicate the category of usage.

◆ OGRE_ALLOC_T

#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.

Referenced by Ogre::AxisAlignedBox::getAllCorners(), Ogre::Terrain::ImportData::operator=(), Ogre::StreamSerialiser::read(), and Ogre::VertexCacheProfiler::VertexCacheProfiler().

◆ OGRE_FREE

#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.

Referenced by Ogre::Terrain::ImportData::destroy(), Ogre::StreamSerialiser::read(), Ogre::AxisAlignedBox::~AxisAlignedBox(), Ogre::SharedPtrInfoFree< T >::~SharedPtrInfoFree(), and Ogre::VertexCacheProfiler::~VertexCacheProfiler().

◆ OGRE_NEW_T

#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.

Referenced by Ogre::AnyNumeric::AnyNumeric(), Ogre::Any::destroy(), Ogre::UserObjectBindings::operator=(), and Ogre::SharedPtr< Skeleton >::SharedPtr().

◆ OGRE_NEW_ARRAY_T

#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.

◆ OGRE_DELETE_T

#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.

Referenced by Ogre::UserObjectBindings::operator=(), Ogre::Any::reset(), Ogre::SharedPtr< Skeleton >::reset(), and Ogre::SharedPtrInfoDeleteT< T >::~SharedPtrInfoDeleteT().

◆ OGRE_DELETE_ARRAY_T

#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.

◆ OGRE_MALLOC_SIMD

#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.

◆ OGRE_MALLOC_ALIGN

#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.

◆ OGRE_ALLOC_T_SIMD

#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.

◆ OGRE_ALLOC_T_ALIGN

#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.

◆ OGRE_FREE_SIMD

#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.

◆ OGRE_FREE_ALIGN

#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.

◆ OGRE_NEW_T_SIMD

#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.

◆ OGRE_NEW_ARRAY_T_SIMD

#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.

◆ OGRE_DELETE_T_SIMD

#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.

◆ OGRE_DELETE_ARRAY_T_SIMD

#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.

◆ OGRE_NEW_T_ALIGN

#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.

◆ OGRE_NEW_ARRAY_T_ALIGN

#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.

◆ OGRE_DELETE_T_ALIGN

#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.

◆ OGRE_DELETE_ARRAY_T_ALIGN

#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.

◆ OGRE_NEW

◆ OGRE_DELETE

Enumeration Type Documentation

◆ 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.

Enumerator
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 

Function Documentation

◆ constructN()

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).

◆ operator==() [1/2]

template<typename T , typename T2 , typename P >
bool Ogre::operator== ( STLAllocator< T, P > const &  ,
STLAllocator< T2, P > const &   
)
inline

◆ operator==() [2/2]

template<typename T , typename P , typename OtherAllocator >
bool Ogre::operator== ( STLAllocator< T, P > const &  ,
OtherAllocator const &   
)
inline

determine equality, can memory from another allocator be released by this allocator, (ISO C++)

◆ operator!=() [1/2]

template<typename T , typename T2 , typename P >
bool Ogre::operator!= ( STLAllocator< T, P > const &  ,
STLAllocator< T2, P > const &   
)
inline

determine equality, can memory from another allocator be released by this allocator, (ISO C++)

Referenced by Ogre::ColourValue::ColourValue(), and Ogre::RTShader::FunctionInvocation::getReturnType().

◆ operator!=() [2/2]

template<typename T , typename P , typename OtherAllocator >
bool Ogre::operator!= ( STLAllocator< T, P > const &  ,
OtherAllocator const &   
)
inline

determine equality, can memory from another allocator be released by this allocator, (ISO C++)