Example #1
0
bool SubAllocator::StartSubAllocator(int SASize)
{
	uint t=SASize << 20;
	if (SubAllocatorSize == t)
		return true;
	StopSubAllocator();
	uint AllocSize=t/FIXED_UNIT_SIZE*UNIT_SIZE+UNIT_SIZE;
	HeapStart = new (std::nothrow) byte [AllocSize];
	if ( !HeapStart )
		rar_out_of_memory();
	
	HeapEnd=HeapStart+AllocSize-UNIT_SIZE;
	SubAllocatorSize=t;
	return true;
}
Example #2
0
bool SubAllocator::StartSubAllocator(int SASize)
{
  uint t=SASize << 20;
  if (SubAllocatorSize == t)
    return TRUE;
  StopSubAllocator();
  uint AllocSize=t/FIXED_UNIT_SIZE*UNIT_SIZE+UNIT_SIZE;
  if ((HeapStart=(byte *)rarmalloc(AllocSize)) == NULL)
  {
    ErrHandler.MemoryError();
    return FALSE;
  }
  HeapEnd=HeapStart+AllocSize-UNIT_SIZE;
  SubAllocatorSize=t;
  return TRUE;
}
Example #3
0
bool SubAllocator::StartSubAllocator(int SASize)
{
  unsigned int t=SASize << 20;
  if (SubAllocatorSize == t)
    return true;
  StopSubAllocator();
  unsigned int AllocSize=t/FIXED_UNIT_SIZE*UNIT_SIZE+UNIT_SIZE;
  if ((HeapStart=(unsigned char *)rarmalloc(AllocSize)) == NULL)
  {
    ErrHandler.MemoryError();
    return false;
  }
  HeapEnd=HeapStart+AllocSize-UNIT_SIZE;
  SubAllocatorSize=t;
  return true;
}
Example #4
0
bool SubAllocator::StartSubAllocator(int SASize)
{
	uint t=SASize << 20;
	if (SubAllocatorSize == t)
		return true;
	StopSubAllocator();
	uint AllocSize=t/FIXED_UNIT_SIZE*UNIT_SIZE+UNIT_SIZE;
#ifdef STRICT_ALIGNMENT_REQUIRED
	AllocSize+=UNIT_SIZE;
#endif
	if ((HeapStart=(byte *)rarmalloc(AllocSize)) == NULL)
	{
		ErrHandler->MemoryError();
		return false;
	}
	HeapEnd=HeapStart+AllocSize-UNIT_SIZE;
	SubAllocatorSize=t;
	return true;
}
Example #5
0
 ~SubAllocator() {StopSubAllocator();}