10 #ifndef ROOT_Minuit2_StackAllocator 11 #define ROOT_Minuit2_StackAllocator 20 #ifdef MN_USE_STACK_ALLOC 21 #define _MN_NO_THREAD_SAVE_ 60 #ifdef _MN_NO_THREAD_SAVE_ 69 #ifdef _MN_NO_THREAD_SAVE_ 76 #ifdef _MN_NO_THREAD_SAVE_ 92 #ifdef DEBUG_ALLOCATOR 97 void* result =
malloc(nBytes);
98 if (!result)
throw std::bad_alloc();
105 #ifdef _MN_NO_THREAD_SAVE_ 107 int delBlock =
ToInt(p);
108 int nextBlock =
ReadInt( delBlock);
109 int previousBlock =
ReadInt( nextBlock -
sizeof(
int));
116 int nextNextBlock =
ReadInt(nextBlock);
117 WriteInt( nextNextBlock -
sizeof(
int), previousBlock);
119 WriteInt( previousBlock, nextNextBlock);
123 #ifdef DEBUG_ALLOCATOR 134 int* ip = (
int*)(
fStack+offset);
145 int* ip =
reinterpret_cast<int*
>(
fStack+offset);
150 unsigned char*
pc =
static_cast<unsigned char*
>(p);
155 return userBlock -
sizeof(int);
159 const int fAlignment = 4;
160 int needed = nBytes % fAlignment == 0 ? nBytes : (nBytes/fAlignment+1)*fAlignment;
161 return needed + 2*
sizeof(int);
185 int beg2 =
ReadInt( end -
sizeof(
int));
226 return gStackAllocator;
define stack allocator symbol
Namespace for new ROOT classes and functions.
int AlignedSize(int nBytes)
StackAllocator controls the memory allocation/deallocation of Minuit.
void CheckOverflow(int n)
void * Allocate(size_t nBytes)
static constexpr double pc
static StackAllocator & Get()
void WriteInt(int offset, int Value)