< prev index next >
test/hotspot/gtest/memory/test_metaspace_allocation.cpp
Print this page
*** 100,112 ****
assert(_spaces[i].space == NULL && _spaces[i].allocated == 0, "Sanity");
if (_spaces[i].lock == NULL) {
_spaces[i].lock = new Mutex(Monitor::native, "gtest-MetaspaceAllocationTest-lock", false, Monitor::_safepoint_check_never);
ASSERT_TRUE(_spaces[i].lock != NULL);
}
! // Let every ~10th space be an unsafe anonymous one to test different allocation patterns.
const Metaspace::MetaspaceType msType = (os::random() % 100 < 10) ?
! Metaspace::UnsafeAnonymousMetaspaceType : Metaspace::StandardMetaspaceType;
{
// Pull lock during space creation, since this is what happens in the VM too
// (see ClassLoaderData::metaspace_non_null(), which we mimick here).
MutexLocker ml(_spaces[i].lock, Mutex::_no_safepoint_check_flag);
_spaces[i].space = new ClassLoaderMetaspace(_spaces[i].lock, msType);
--- 100,112 ----
assert(_spaces[i].space == NULL && _spaces[i].allocated == 0, "Sanity");
if (_spaces[i].lock == NULL) {
_spaces[i].lock = new Mutex(Monitor::native, "gtest-MetaspaceAllocationTest-lock", false, Monitor::_safepoint_check_never);
ASSERT_TRUE(_spaces[i].lock != NULL);
}
! // Let every ~10th space be a short-lived one to test different allocation patterns.
const Metaspace::MetaspaceType msType = (os::random() % 100 < 10) ?
! Metaspace::ShortLivedMetaspaceType : Metaspace::StandardMetaspaceType;
{
// Pull lock during space creation, since this is what happens in the VM too
// (see ClassLoaderData::metaspace_non_null(), which we mimick here).
MutexLocker ml(_spaces[i].lock, Mutex::_no_safepoint_check_flag);
_spaces[i].space = new ClassLoaderMetaspace(_spaces[i].lock, msType);
< prev index next >