Under the override regime operator new is defined as _hz_mem_allocate(), which calls whatever function fnptr_Alloc points to (initially this function). Delete is defined as _hz_mem_release(), which calls whatever function fnptr_Free points to. Currently, fnptr_Free always points to _regime_free_norm(), which tests _hzGlobal_XM to decide how to delete memory. The first memory allocated for the program is allocated via this function, purely so _hzGlobal_XM can be tested before ANY further allocations. This function decides to set fnptr_Alloc to either _regime_alloc_Syst() for malloc/free and _regime_alloc_Ovrd for the override - then calls the selected function to allocate the requested memory. All subsequent allocations will be from whichever funtion fnptr_Alloc is set to. Pointer to allocated memory block

Return TypeFunction nameArguments
void*_regime_alloc_Init(uint32_t,)

Declared and defined in file: hzMemory.cpp

Function Logic:

0:START 1:unknown 2:unknown 3:items items 4:bBeenHere s_Heap items items s_Heap fnptr_Alloc fnptr_Free 5:fnptr_Alloc fnptr_Free 6:ptr 7:Return ptr

Function body:

void* _regime_alloc_Init (uint32_t size)
{
   //  Category: Memory
   //  
   //  Under the override regime operator new is defined as _hz_mem_allocate(), which calls whatever function fnptr_Alloc points to (initially this function). Delete is defined as
   //  _hz_mem_release(), which calls whatever function fnptr_Free points to. Currently, fnptr_Free always points to _regime_free_norm(), which tests _hzGlobal_XM to decide how to
   //  delete memory.
   //  
   //  The first memory allocated for the program is allocated via this function, purely so _hzGlobal_XM can be tested before ANY further allocations. This function decides to set
   //  fnptr_Alloc to either _regime_alloc_Syst() for malloc/free and _regime_alloc_Ovrd for the override - then calls the selected function to allocate the requested memory. All
   //  subsequent allocations will be from whichever funtion fnptr_Alloc is set to.
   //  
   //  Arguments: 1) size Number of bytes to allocate
   //  Returns: Pointer to allocated memory block
   static  bool    bBeenHere = false ;
   void*   ptr ;       //  New object space
   if (_hzGlobal_XM)
   {
       if (bBeenHere)
           { printf("_regime_alloc_Init: Duplicate Call\n") ; exit(1); }
       bBeenHere = true ;
       //  printf("Allocating the heap %p %p\n", *fnptr_Alloc, *fnptr_Free) ; fflush(stdout) ;
       s_Heap = (_hz_heap*) malloc(sizeof(_hz_heap)) ;
       memset(s_Heap, 0,sizeof(_hz_heap)) ;
       s_Heap->nCallsMalloc++ ;
       s_Heap->nOverSize += sizeof(_hz_heap) ;
       fnptr_Alloc = _regime_alloc_Ovrd ;
       fnptr_Free = _regime_free_Ovrd ;
   }
   else
   {
       fnptr_Alloc = _regime_alloc_Syst ;
       fnptr_Free = _regime_free_Syst ;
   }
   //  printf("Now Allocating the memory using approved fn\n") ; fflush(stdout) ;
   ptr = fnptr_Alloc(size) ;
   return ptr ;
}