webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
Default memory allocator used by the parser and DOM. More...
#include <allocators.h>
Public Member Functions | |
MemoryPoolAllocator (size_t chunkSize=kDefaultChunkCapacity, BaseAllocator *baseAllocator=0) | |
Constructor with chunkSize. More... | |
MemoryPoolAllocator (void *buffer, size_t size, size_t chunkSize=kDefaultChunkCapacity, BaseAllocator *baseAllocator=0) | |
Constructor with user-supplied buffer. More... | |
~MemoryPoolAllocator () | |
Destructor. More... | |
void | Clear () |
Deallocates all memory chunks, excluding the user-supplied buffer. More... | |
size_t | Capacity () const |
Computes the total capacity of allocated memory chunks. More... | |
size_t | Size () const |
Computes the memory blocks allocated. More... | |
void * | Malloc (size_t size) |
Allocates a memory block. (concept Allocator) More... | |
void * | Realloc (void *originalPtr, size_t originalSize, size_t newSize) |
Resizes a memory block (concept Allocator) More... | |
Static Public Member Functions | |
static void | Free (void *ptr) |
Frees a memory block (concept Allocator) More... | |
Static Public Attributes | |
static const bool | kNeedFree = false |
Tell users that no need to call Free() with this allocator. (concept Allocator) More... | |
Default memory allocator used by the parser and DOM.
This allocator allocate memory blocks from pre-allocated memory chunks.
It does not free memory blocks. And Realloc() only allocate new memory.
The memory chunks are allocated by BaseAllocator, which is CrtAllocator by default.
User may also supply a buffer as the first chunk.
If the user-buffer is full then additional chunks are allocated by BaseAllocator.
The user-buffer is not deallocated by this allocator.
BaseAllocator | the allocator type for allocating memory chunks. Default is CrtAllocator. |
|
inline |
|
inline |
|
inline |
Destructor.
This deallocates all memory chunks, excluding the user-supplied buffer.
|
inline |
Computes the total capacity of allocated memory chunks.
|
inline |
Deallocates all memory chunks, excluding the user-supplied buffer.
|
inlinestatic |
Frees a memory block (concept Allocator)
|
inline |
Allocates a memory block. (concept Allocator)
|
inline |
Resizes a memory block (concept Allocator)
|
inline |
Computes the memory blocks allocated.
|
static |
Tell users that no need to call Free() with this allocator. (concept Allocator)