--- old/src/share/vm/memory/heap.cpp 2017-02-06 15:17:32.733815903 +0100 +++ new/src/share/vm/memory/heap.cpp 2017-02-06 15:17:32.573815898 +0100 @@ -190,6 +190,9 @@ if (block != NULL) { assert(block->length() >= number_of_segments && block->length() < number_of_segments + CodeCacheMinBlockLength, "sanity check"); assert(!block->free(), "must be marked free"); + guarantee((char*) block >= _memory.low(), + "The newly allocated block " INTPTR_FORMAT " is not within the heap starting with " INTPTR_FORMAT, + p2i(block), p2i(_memory.low())); DEBUG_ONLY(memset((void*)block->allocated_space(), badCodeHeapNewVal, instance_size)); _max_allocated_capacity = MAX2(_max_allocated_capacity, allocated_capacity()); _blob_count++; @@ -204,6 +207,9 @@ HeapBlock* b = block_at(_next_segment); b->initialize(number_of_segments); _next_segment += number_of_segments; + guarantee((char*) b >= _memory.low(), + "The newly allocated block " INTPTR_FORMAT " is not within the heap starting with " INTPTR_FORMAT, + p2i(b), p2i(_memory.low())); DEBUG_ONLY(memset((void *)b->allocated_space(), badCodeHeapNewVal, instance_size)); _max_allocated_capacity = MAX2(_max_allocated_capacity, allocated_capacity()); _blob_count++; @@ -219,6 +225,9 @@ // Find start of HeapBlock HeapBlock* b = (((HeapBlock *)p) - 1); assert(b->allocated_space() == p, "sanity check"); + guarantee((char*) b >= _memory.low(), + "The block to be deallocated " INTPTR_FORMAT " is not within the heap starting with " INTPTR_FORMAT, + p2i(b), p2i(_memory.low())); DEBUG_ONLY(memset((void *)b->allocated_space(), badCodeHeapFreeVal, segments_to_size(b->length()) - sizeof(HeapBlock))); add_to_freelist(b);