fix memory allocation

This commit is contained in:
Vitor Santos Costa 2013-03-19 21:25:46 -05:00
parent 0ea010f3b2
commit c364fccda8

View File

@ -882,6 +882,8 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity,
static void static void
InitStdPreds(void) InitStdPreds(void)
{ {
void initIO(void);
Yap_InitCPreds(); Yap_InitCPreds();
Yap_InitBackCPreds(); Yap_InitBackCPreds();
BACKUP_MACHINE_REGS(); BACKUP_MACHINE_REGS();
@ -1288,17 +1290,21 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
if (Heap < MinHeapSpace) if (Heap < MinHeapSpace)
Heap = MinHeapSpace; Heap = MinHeapSpace;
Heap = AdjustPageSize(Heap * K); Heap = AdjustPageSize(Heap * K);
Heap /= (K);
/* sanity checking for data areas */ /* sanity checking for data areas */
if (Trail < MinTrailSpace) if (Trail < MinTrailSpace)
Trail = MinTrailSpace; Trail = MinTrailSpace;
Trail = AdjustPageSize(Trail * K); Trail = AdjustPageSize(Trail * K);
Trail /= (K);
if (Stack < MinStackSpace) if (Stack < MinStackSpace)
Stack = MinStackSpace; Stack = MinStackSpace;
Stack = AdjustPageSize(Stack * K); Stack = AdjustPageSize(Stack * K);
Stack /= (K);
if (!Atts) if (!Atts)
Atts = 2048*sizeof(CELL); Atts = 2048*sizeof(CELL);
else else
Atts = AdjustPageSize(Atts * K); Atts = AdjustPageSize(Atts * K);
Atts /= (K);
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
worker_id = 0; worker_id = 0;
#endif /* YAPOR || THREADS */ #endif /* YAPOR || THREADS */