TrinityCore
|
Allocates memory in large blocks and then frees it as an area. More...
#include <AreaMemoryManager.h>
Classes | |
class | Buffer |
Public Types | |
typedef shared_ptr < AreaMemoryManager > | Ref |
Public Types inherited from G3D::MemoryManager | |
typedef shared_ptr< class MemoryManager > | Ref |
Public Member Functions | |
~AreaMemoryManager () | |
size_t | bytesAllocated () const |
virtual void * | alloc (size_t s) |
virtual void | free (void *x) |
virtual bool | isThreadsafe () const |
void | deallocateAll () |
Public Member Functions inherited from G3D::ReferenceCountedObject | |
virtual | ~ReferenceCountedObject () |
Static Public Member Functions | |
static AreaMemoryManager::Ref | create (size_t sizeHint=10 *1024 *1024) |
Static Public Member Functions inherited from G3D::MemoryManager | |
static MemoryManager::Ref | create () |
Private Member Functions | |
AreaMemoryManager (size_t sizeHint) | |
Private Attributes | |
size_t | m_sizeHint |
Array< Buffer * > | m_bufferArray |
Additional Inherited Members | |
Protected Member Functions inherited from G3D::MemoryManager | |
MemoryManager () | |
Allocates memory in large blocks and then frees it as an area.
Useful for ensuring cache coherence and for reducing the time cost of multiple allocations and deallocations.
Not threadsafe
typedef shared_ptr<AreaMemoryManager> G3D::AreaMemoryManager::Ref |
|
private |
G3D::AreaMemoryManager::~AreaMemoryManager | ( | ) |
Invokes deallocateAll.
|
virtual |
Allocates memory out of the buffer pool.
s | must be no larger than sizeHint |
Reimplemented from G3D::MemoryManager.
size_t G3D::AreaMemoryManager::bytesAllocated | ( | ) | const |
|
static |
sizeHint | Total amount of memory expected to be allocated. The allocator will allocate memory from the system in increments of this size. |
void G3D::AreaMemoryManager::deallocateAll | ( | ) |
Deletes all previously allocated memory. Because delete is not invoked on objects in this memory, it is not safe to simply free memory containing C++ objects that expect their destructors to be called.
|
virtual |
|
virtual |
Returns true if this memory manager is threadsafe (i.e., alloc and free can be called asychronously)
Reimplemented from G3D::MemoryManager.
The underlying array is stored in regular MemoryManager heap memory
|
private |