X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fsm%2FStorage.c;h=3ede82d14157bc4d6e2e223f61c0f54a095e7e85;hb=4c6a3f787abcaed009a574196d82237d9ae64fc8;hp=eb29b2daf6c96e7cae7dda741b0cfa37772ce2e3;hpb=c1540c3def6281ea67b5a4ce7499b1aa982faa25;p=ghc-hetmet.git diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index eb29b2d..3ede82d 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -116,7 +116,8 @@ initStorage( void ) /* Sanity check to make sure the LOOKS_LIKE_ macros appear to be * doing something reasonable. */ - ASSERT(LOOKS_LIKE_INFO_PTR(&stg_BLACKHOLE_info)); + /* We use the NOT_NULL variant or gcc warns that the test is always true */ + ASSERT(LOOKS_LIKE_INFO_PTR_NOT_NULL(&stg_BLACKHOLE_info)); ASSERT(LOOKS_LIKE_CLOSURE_PTR(&stg_dummy_ret_closure)); ASSERT(!HEAP_ALLOCED(&stg_dummy_ret_closure)); @@ -565,6 +566,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; + + // 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 @@ -663,7 +672,9 @@ allocateLocal (Capability *cap, nat n) 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