10#ifndef ROOT_Minuit2_StackAllocator
11#define ROOT_Minuit2_StackAllocator
20#ifdef MN_USE_STACK_ALLOC
21#define _MN_NO_THREAD_SAVE_
54#ifdef _MN_NO_THREAD_SAVE_
64#ifdef _MN_NO_THREAD_SAVE_
73#ifdef _MN_NO_THREAD_SAVE_
95 void *result =
malloc(nBytes);
97 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));
115 int nextNextBlock =
ReadInt(nextBlock);
116 WriteInt(nextNextBlock -
sizeof(
int), previousBlock);
118 WriteInt(previousBlock, nextNextBlock);
122#ifdef DEBUG_ALLOCATOR
134 int *ip = (
int *)(
fStack + offset);
146 int *ip =
reinterpret_cast<int *
>(
fStack + offset);
152 unsigned char *pc =
static_cast<unsigned char *
>(p);
156 int userBlock = pc -
fStack;
157 return userBlock -
sizeof(
int);
162 const int fAlignment = 4;
163 int needed = nBytes % fAlignment == 0 ? nBytes : (nBytes / fAlignment + 1) * fAlignment;
164 return needed + 2 *
sizeof(
int);
190 int beg2 =
ReadInt(end -
sizeof(
int));
226 return gStackAllocator;
static StackAllocator & Get()
StackAllocator controls the memory allocation/deallocation of Minuit.
void WriteInt(int offset, int Value)
void * Allocate(size_t nBytes)
void CheckOverflow(int n)
int AlignedSize(int nBytes)
define stack allocator symbol
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...