TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
G3D::MemoryManager Class Reference

#include <MemoryManager.h>

Public Types

typedef shared_ptr< class
MemoryManager
Ref
 

Public Member Functions

virtual void * alloc (size_t s)
 
virtual void free (void *ptr)
 
virtual bool isThreadsafe () const
 
- Public Member Functions inherited from G3D::ReferenceCountedObject
virtual ~ReferenceCountedObject ()
 

Static Public Member Functions

static MemoryManager::Ref create ()
 

Protected Member Functions

 MemoryManager ()
 

Detailed Description

Abstraction of memory management. Default implementation uses G3D::System::malloc and is threadsafe.

See also
LargePoolMemoryManager, CRTMemoryManager, AlignedMemoryManager, AreaMemoryManager

Member Typedef Documentation

typedef shared_ptr<class MemoryManager> G3D::MemoryManager::Ref

Constructor & Destructor Documentation

G3D::MemoryManager::MemoryManager ( )
protected
17 {}

+ Here is the caller graph for this function:

Member Function Documentation

void * G3D::MemoryManager::alloc ( size_t  s)
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::CRTMemoryManager, G3D::AreaMemoryManager, and G3D::AlignedMemoryManager.

20  {
21  return System::malloc(s);
22 }
static void * malloc(size_t bytes)
Definition: System.cpp:1441

+ Here is the call graph for this function:

MemoryManager::Ref G3D::MemoryManager::create ( )
static

Return the instance. There's only one instance of the default MemoryManager; it is cached after the first creation.

35  {
36  static MemoryManager::Ref m(new MemoryManager());
37  return m;
38 }
shared_ptr< class MemoryManager > Ref
Definition: MemoryManager.h:31
MemoryManager()
Definition: MemoryManager.cpp:17

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void G3D::MemoryManager::free ( void *  ptr)
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::CRTMemoryManager, G3D::AreaMemoryManager, and G3D::AlignedMemoryManager.

25  {
26  System::free(ptr);
27 }
static void free(void *p)
Definition: System.cpp:1473

+ Here is the call graph for this function:

bool G3D::MemoryManager::isThreadsafe ( ) const
virtual

Returns true if this memory manager is threadsafe (i.e., alloc and free can be called asychronously)

Reimplemented in G3D::CRTMemoryManager, G3D::AreaMemoryManager, and G3D::AlignedMemoryManager.

30  {
31  return true;
32 }

The documentation for this class was generated from the following files: