src/share/vm/services/memSnapshot.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/services/memSnapshot.cpp	Thu Nov  8 11:03:15 2012
--- new/src/share/vm/services/memSnapshot.cpp	Thu Nov  8 11:03:14 2012

*** 121,144 **** --- 121,155 ---- // we don't consolidate reserved regions, since they may be categorized // in different types. bool VMMemPointerIterator::add_reserved_region(MemPointerRecord* rec) { assert(rec->is_allocation_record(), "Sanity check"); ! VMMemRegion* cur = (VMMemRegion*)current(); ! VMMemRegion* reserved_rgn = (VMMemRegion*)current(); // we don't have anything yet ! if (cur == NULL) { ! if (reserved_rgn == NULL) { return insert_record(rec); } ! assert(cur->is_reserved_region(), "Sanity check"); ! assert(reserved_rgn->is_reserved_region(), "Sanity check"); // duplicated records ! if (cur->is_same_region(rec)) { ! if (reserved_rgn->is_same_region(rec)) { return true; } assert(cur->base() > rec->addr(), "Just check: locate()"); assert(!cur->overlaps_region(rec), "overlapping reserved regions"); + // an attached JNI thread can exit without detaching the thread, that results + // JVM to leak JavaThread object (JDK-8001743) + if (CheckJNICalls) { + guarantee(FLAGS_TO_MEMORY_TYPE(reserved_rgn->flags()) != mtThreadStack || + !reserved_rgn->overlaps_region(rec), + "Attached JNI thread exited without being detached"); + } + // otherwise, we should not have overlapping reserved regions + assert(FLAGS_TO_MEMORY_TYPE(reserved_rgn->flags()) == mtThreadStack || + reserved_rgn->base() > rec->addr(), "Just check: locate()"); + assert(FLAGS_TO_MEMORY_TYPE(reserved_rgn->flags()) == mtThreadStack || + !reserved_rgn->overlaps_region(rec), "overlapping reserved regions"); + return insert_record(rec); } // we do consolidate committed regions bool VMMemPointerIterator::add_committed_region(MemPointerRecord* rec) {

src/share/vm/services/memSnapshot.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File