Support Forum G3D Web Page |
Abstraction of memory management. More...
Inherits G3D::ReferenceCountedObject.
Inherited by G3D::AlignedMemoryManager, G3D::AreaMemoryManager, G3D::BufferUnmapper, and G3D::CRTMemoryManager.
Public Member Functions | |
virtual void * | alloc (size_t s) |
Return a pointer to s bytes of memory that are unused by the rest of the program. More... | |
virtual void | free (void *ptr) |
Invoke to declare that this memory will no longer be used by the program. More... | |
virtual bool | isThreadsafe () const |
Returns true if this memory manager is threadsafe (i.e., alloc and free can be called asychronously) More... | |
Static Public Member Functions | |
static shared_ptr< MemoryManager > | create () |
Return the instance. More... | |
Protected Member Functions | |
MemoryManager () | |
Static Protected Member Functions | |
template<class T , class ... ArgTypes> | |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
Like std::make_shared, but works for protected constructors. More... | |
Abstraction of memory management.
Default implementation uses G3D::System::malloc and is threadsafe.
|
protected |
|
virtual |
Return a pointer to s bytes of memory that are unused by the rest of the program.
The contents of the memory are undefined
Reimplemented in G3D::BufferUnmapper, G3D::CRTMemoryManager, G3D::AreaMemoryManager, and G3D::AlignedMemoryManager.
|
static |
Return the instance.
There's only one instance of the default MemoryManager; it is cached after the first creation.
Referenced by G3D::Array< G3D::AABox >::Array(), G3D::categorizeByDerivedType(), and G3D::Table< String, double >::Table().
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
|
virtual |
Invoke to declare that this memory will no longer be used by the program.
The memory manager is not required to actually reuse or release this memory.
Reimplemented in G3D::BufferUnmapper, G3D::CRTMemoryManager, G3D::AreaMemoryManager, and G3D::AlignedMemoryManager.
|
virtual |
Returns true if this memory manager is threadsafe (i.e., alloc and free can be called asychronously)
Reimplemented in G3D::BufferUnmapper, G3D::CRTMemoryManager, G3D::AreaMemoryManager, and G3D::AlignedMemoryManager.