OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Memory
+ Collaboration diagram for 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::NedAlignedAllocPolicy< Alignment >
 An allocation policy for use with AllocatedObject and STLAllocator, which aligns memory at a given boundary (which should be a power of 2). More...
 
class  Ogre::NedAllocImpl
 Non-templated utility class just to hide nedmalloc. More...
 
class  Ogre::NedAllocPolicy
 An allocation policy for use with AllocatedObject and STLAllocator. More...
 
class  Ogre::NedPoolingAlignedPolicy< Alignment >
 An allocation policy for use with AllocatedObject and STLAllocator, which aligns memory at a given boundary (which should be a power of 2). More...
 
class  Ogre::NedPoolingImpl
 Non-templated utility class just to hide nedmalloc. More...
 
class  Ogre::NedPoolingPolicy
 An allocation policy for use with AllocatedObject and STLAllocator. More...
 
class  Ogre::StdAlignedAllocPolicy< Alignment >
 A "standard" allocation policy for use with AllocatedObject and STLAllocator, which aligns memory at a given boundary (which should be a power of 2). More...
 
class  Ogre::StdAllocPolicy
 A "standard" allocation policy for use with AllocatedObject and STLAllocator. 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

#define OGRE_ALLOC_T (   T,
  count,
  category 
)    static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))
#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 447 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 445 of file OgreMemoryAllocatorConfig.h.

#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 437 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 468 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 460 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 435 of file OgreMemoryAllocatorConfig.h.

Referenced by Ogre::Any::destroy(), and Ogre::SharedPtr< D3D11GpuProgram >::destroy().

#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 466 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 458 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 428 of file OgreMemoryAllocatorConfig.h.

Referenced by Ogre::SharedPtr< D3D11GpuProgram >::destroy(), Ogre::Terrain::ImportData::destroy(), Ogre::StreamSerialiser::readConverted(), Ogre::StreamSerialiser::writeConverted(), 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 451 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 449 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 424 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 443 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 441 of file OgreMemoryAllocatorConfig.h.

#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 433 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 464 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 456 of file OgreMemoryAllocatorConfig.h.

#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 462 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 454 of file OgreMemoryAllocatorConfig.h.

Enumeration Type Documentation

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 

Definition at line 158 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 344 of file OgreMemoryAllocatorConfig.h.

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

Definition at line 195 of file OgreMemorySTLAllocator.h.

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

Definition at line 205 of file OgreMemorySTLAllocator.h.

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

Definition at line 177 of file OgreMemorySTLAllocator.h.

Referenced by Ogre::Matrix3::operator!=(), and Ogre::Quaternion::operator!=().

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

Definition at line 187 of file OgreMemorySTLAllocator.h.