< prev index next >

src/hotspot/share/memory/metaspace.cpp

Print this page
   1 /*
   2  * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


4053 void Metaspace::purge() {
4054   MutexLockerEx cl(SpaceManager::expand_lock(),
4055                    Mutex::_no_safepoint_check_flag);
4056   purge(NonClassType);
4057   if (using_class_space()) {
4058     purge(ClassType);
4059   }
4060 }
4061 
4062 void Metaspace::print_on(outputStream* out) const {
4063   // Print both class virtual space counts and metaspace.
4064   if (Verbose) {
4065     vsm()->print_on(out);
4066     if (using_class_space()) {
4067       class_vsm()->print_on(out);
4068     }
4069   }
4070 }
4071 
4072 bool Metaspace::contains(const void* ptr) {
4073   if (UseSharedSpaces && MetaspaceShared::is_in_shared_space(ptr)) {
4074     return true;
4075   }
4076   return contains_non_shared(ptr);
4077 }
4078 
4079 bool Metaspace::contains_non_shared(const void* ptr) {
4080   if (using_class_space() && get_space_list(ClassType)->contains(ptr)) {
4081      return true;
4082   }
4083 
4084   return get_space_list(NonClassType)->contains(ptr);
4085 }
4086 
4087 void Metaspace::verify() {
4088   vsm()->verify();
4089   if (using_class_space()) {
4090     class_vsm()->verify();
4091   }
4092 }
4093 


   1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


4053 void Metaspace::purge() {
4054   MutexLockerEx cl(SpaceManager::expand_lock(),
4055                    Mutex::_no_safepoint_check_flag);
4056   purge(NonClassType);
4057   if (using_class_space()) {
4058     purge(ClassType);
4059   }
4060 }
4061 
4062 void Metaspace::print_on(outputStream* out) const {
4063   // Print both class virtual space counts and metaspace.
4064   if (Verbose) {
4065     vsm()->print_on(out);
4066     if (using_class_space()) {
4067       class_vsm()->print_on(out);
4068     }
4069   }
4070 }
4071 
4072 bool Metaspace::contains(const void* ptr) {
4073   if (MetaspaceShared::is_in_shared_metaspace(ptr)) {
4074     return true;
4075   }
4076   return contains_non_shared(ptr);
4077 }
4078 
4079 bool Metaspace::contains_non_shared(const void* ptr) {
4080   if (using_class_space() && get_space_list(ClassType)->contains(ptr)) {
4081      return true;
4082   }
4083 
4084   return get_space_list(NonClassType)->contains(ptr);
4085 }
4086 
4087 void Metaspace::verify() {
4088   vsm()->verify();
4089   if (using_class_space()) {
4090     class_vsm()->verify();
4091   }
4092 }
4093 


< prev index next >