projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Optionally use libffi to implement 'foreign import "wrapper"' (#793)
[ghc-hetmet.git]
/
rts
/
sm
/
Storage.c
diff --git
a/rts/sm/Storage.c
b/rts/sm/Storage.c
index
eb29b2d
..
68dfb19
100644
(file)
--- a/
rts/sm/Storage.c
+++ b/
rts/sm/Storage.c
@@
-565,6
+565,14
@@
allocateInGen (generation *g, nat n)
if (n >= LARGE_OBJECT_THRESHOLD/sizeof(W_))
{
nat req_blocks = (lnat)BLOCK_ROUND_UP(n*sizeof(W_)) / BLOCK_SIZE;
if (n >= LARGE_OBJECT_THRESHOLD/sizeof(W_))
{
nat req_blocks = (lnat)BLOCK_ROUND_UP(n*sizeof(W_)) / BLOCK_SIZE;
+
+ // Attempting to allocate an object larger than maxHeapSize
+ // should definitely be disallowed. (bug #1791)
+ if (RtsFlags.GcFlags.maxHeapSize > 0 &&
+ req_blocks >= RtsFlags.GcFlags.maxHeapSize) {
+ heapOverflow();
+ }
+
bd = allocGroup(req_blocks);
dbl_link_onto(bd, &stp->large_objects);
stp->n_large_blocks += bd->blocks; // might be larger than req_blocks
bd = allocGroup(req_blocks);
dbl_link_onto(bd, &stp->large_objects);
stp->n_large_blocks += bd->blocks; // might be larger than req_blocks
@@
-663,7
+671,9
@@
allocateLocal (Capability *cap, nat n)
bd->gen_no = 0;
bd->step = cap->r.rNursery;
bd->flags = 0;
bd->gen_no = 0;
bd->step = cap->r.rNursery;
bd->flags = 0;
- alloc_blocks++;
+ // NO: alloc_blocks++;
+ // calcAllocated() uses the size of the nursery, and we've
+ // already bumpted nursery->n_blocks above.
} else {
// we have a block in the nursery: take it and put
// it at the *front* of the nursery list, and use it
} else {
// we have a block in the nursery: take it and put
// it at the *front* of the nursery list, and use it