ask YAP to get memory step by step in 64 bit maachines.

This commit is contained in:
Vitor Santos Costa 2011-01-20 11:59:54 -06:00
parent 26706d20ff
commit d024e9f0ae

View File

@ -1596,14 +1596,28 @@ Yap_ExtendWorkSpaceThroughHole(UInt s)
return -1; return -1;
} }
#endif #endif
} #elif SIZEOF_INT_P==8
WorkSpaceTop = WorkSpaceTop0; {
#endif int n = 1024*1024;
if (ExtendWorkSpace(s, 0)) { while (n) {
/* progress 1 MB */
WorkSpaceTop += 512*1024;
if (ExtendWorkSpace(s, MAP_FIXED)) {
Yap_add_memory_hole((ADDR)WorkSpaceTop0, (ADDR)WorkSpaceTop-s); Yap_add_memory_hole((ADDR)WorkSpaceTop0, (ADDR)WorkSpaceTop-s);
Yap_ErrorMessage = NULL; Yap_ErrorMessage = NULL;
return WorkSpaceTop-WorkSpaceTop0; return WorkSpaceTop-WorkSpaceTop0;
} }
#if defined(_WIN32)
/* 487 happens when you step over someone else's memory */
if (GetLastError() != 487) {
WorkSpaceTop = WorkSpaceTop0;
return -1;
}
#endif
}
#endif
}
WorkSpaceTop = WorkSpaceTop0;
#endif #endif
return -1; return -1;
} }