[MLton-commit] r7055
Matthew Fluet
fluet at mlton.org
Wed Apr 8 05:31:45 PDT 2009
Attempting to allocate more than the virtual address space is destined to fail.
----------------------------------------------------------------------
U mlton/trunk/runtime/gc/heap.c
----------------------------------------------------------------------
Modified: mlton/trunk/runtime/gc/heap.c
===================================================================
--- mlton/trunk/runtime/gc/heap.c 2009-04-08 12:31:41 UTC (rev 7054)
+++ mlton/trunk/runtime/gc/heap.c 2009-04-08 12:31:44 UTC (rev 7055)
@@ -290,12 +290,17 @@
*/
bool createHeapSecondary (GC_state s, size_t desiredSize) {
size_t desiredWithMapsSize;
+ size_t minSize, minWithMapsSize;
desiredWithMapsSize = desiredSize + sizeofCardMapAndCrossMap (s, desiredSize);
if ((s->controls.fixedHeap > 0
and s->heap.withMapsSize + desiredWithMapsSize > s->controls.fixedHeap)
or (s->controls.maxHeap > 0
and s->heap.withMapsSize + desiredWithMapsSize > s->controls.maxHeap))
return FALSE;
+ minSize = align (s->heap.oldGenSize, s->sysvals.pageSize);
+ minWithMapsSize = minSize + sizeofCardMapAndCrossMap (s, minSize);
+ if (minWithMapsSize > SIZE_MAX - s->heap.withMapsSize)
+ return FALSE;
return createHeap (s, &s->secondaryHeap, desiredSize, s->heap.oldGenSize);
}
More information about the MLton-commit
mailing list