50 #define MEMSIZE 4194304
62 return (
void *)GlobalAlloc(GMEM_FIXED, Size);
76 if (GlobalSize(MemoryBlock))
77 GlobalFree(MemoryBlock);
98 tmpPtr = VirtualAlloc(NULL,
MEMSIZE, MEM_RESERVE|MEM_TOP_DOWN, PAGE_READWRITE);
104 tmpPtr = VirtualAlloc(tmpPtr, segmentSize, MEM_COMMIT, PAGE_READWRITE);
124 newPool->
nextAlloc = ((
char *)newPool) + segmentSize;
140 void *MemorySegmentPool::operator
new(
size_t size,
size_t minSize)
149 size_t initialSegSize;
163 tmpPtr = VirtualAlloc(NULL, poolSize, MEM_RESERVE|MEM_TOP_DOWN, PAGE_READWRITE);
181 tmpPtr = VirtualAlloc(tmpPtr, initialSegSize, MEM_COMMIT, PAGE_READWRITE);
201 newPool->
nextAlloc = ((
char *)newPool) + initialSegSize;
247 tmpPtr = VirtualAlloc((
void *)this->
nextAlloc, segmentSize, MEM_COMMIT,PAGE_READWRITE);
267 this->
next = newPool;
303 tmpPtr = VirtualAlloc((
void *)(this->
nextLargeAlloc - segmentSize), segmentSize, MEM_COMMIT,PAGE_READWRITE);
321 this->
next = newPool;
337 VirtualFree(
this, 0, MEM_RELEASE);
void reportException(wholenumber_t error)
#define MemorySegmentPoolOverhead
#define Error_System_resources
MemorySegment * newLargeSegment(size_t minSize)
MemorySegment * newSegment(size_t minSize)
static MemorySegmentPool * createPool()
MemorySegmentPool * nextPool()
void setNext(MemorySegmentPool *nextPool)
void memoryPoolAdded(MemorySegmentPool *)
static void * allocateResultMemory(size_t)
static void releaseResultMemory(void *)