src/share/vm/memory/heap.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/memory/heap.cpp	Mon Feb  6 15:17:32 2017
--- new/src/share/vm/memory/heap.cpp	Mon Feb  6 15:17:32 2017

*** 188,197 **** --- 188,200 ---- NOT_PRODUCT(verify()); 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++; return block->allocated_space(); }
*** 202,211 **** --- 205,217 ---- if (_next_segment + number_of_segments <= _number_of_committed_segments) { mark_segmap_as_used(_next_segment, _next_segment + number_of_segments); 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++; return b->allocated_space(); } else {
*** 217,226 **** --- 223,235 ---- void CodeHeap::deallocate(void* p) { assert(p == find_start(p), "illegal deallocation"); // 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); NOT_PRODUCT(verify()); }

src/share/vm/memory/heap.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File