B
Billy
Is it possible to access the standard global new operator after it's been
overridden? For instance, I have a situation like this
void* operator new( size_t numBytes )
{
return sDefaultHeap->Allocate( numBytes );
}
Heap::Heap( unsigned int memSize )
{
// allocate memory for the heap
m_memory = new char[ memSize ];
}
void InitDefaultHeap( void )
{
// this function doesn't currently work because new has been
// overridden
char* defaultMem = new char[1024];
sDefaultHeap( defaultMem, 1024 );
}
The overridden new allocates from the default heap, but the problem is
that default heap must be allocated using the standard new operator and
not the overridden one. Is this possible? My heap class (not the one
shown) can take external allocations to take care of the default heap
case, but I can't seem to figure out how to make this all work.
overridden? For instance, I have a situation like this
void* operator new( size_t numBytes )
{
return sDefaultHeap->Allocate( numBytes );
}
Heap::Heap( unsigned int memSize )
{
// allocate memory for the heap
m_memory = new char[ memSize ];
}
void InitDefaultHeap( void )
{
// this function doesn't currently work because new has been
// overridden
char* defaultMem = new char[1024];
sDefaultHeap( defaultMem, 1024 );
}
The overridden new allocates from the default heap, but the problem is
that default heap must be allocated using the standard new operator and
not the overridden one. Is this possible? My heap class (not the one
shown) can take external allocations to take care of the default heap
case, but I can't seem to figure out how to make this all work.