# HG changeset patch # User stefank # Date 1355823651 -3600 # Node ID c7187933529195eba2234dc038f9b32c6630cff7 # Parent 32164d89fe9ccdd11bb7abf29fcadaa32853556d 8005108: NPG: MetaspaceAux::used_in_bytes(), capacity_in_bytes() and reserved_in_bytes() return inconsistent numbers Summary: Reverted the changes to these functions from JDK-8000662 Reviewed-by: brutisso, jmasa diff -r 32164d89fe9c -r c71879335291 src/share/vm/memory/metaspace.cpp --- a/src/share/vm/memory/metaspace.cpp Mon Dec 17 15:25:26 2012 +0100 +++ b/src/share/vm/memory/metaspace.cpp Tue Dec 18 10:40:51 2012 +0100 @@ -2192,11 +2192,6 @@ // MetaspaceAux -size_t MetaspaceAux::used_in_bytes() { - return (Metaspace::class_space_list()->used_words_sum() + - Metaspace::space_list()->used_words_sum()) * BytesPerWord; -} - size_t MetaspaceAux::used_in_bytes(Metaspace::MetadataType mdtype) { size_t used = 0; ClassLoaderDataGraphMetaspaceIterator iter; @@ -2222,14 +2217,6 @@ return free * BytesPerWord; } -// The total words available for metadata allocation. This -// uses Metaspace capacity_words() which is the total words -// in chunks allocated for a Metaspace. -size_t MetaspaceAux::capacity_in_bytes() { - return (Metaspace::class_space_list()->capacity_words_sum() + - Metaspace::space_list()->capacity_words_sum()) * BytesPerWord; -} - size_t MetaspaceAux::capacity_in_bytes(Metaspace::MetadataType mdtype) { size_t capacity = free_chunks_total(mdtype); ClassLoaderDataGraphMetaspaceIterator iter; @@ -2242,11 +2229,6 @@ return capacity * BytesPerWord; } -size_t MetaspaceAux::reserved_in_bytes() { - return (Metaspace::class_space_list()->virtual_space_total() + - Metaspace::space_list()->virtual_space_total()) * BytesPerWord; -} - size_t MetaspaceAux::reserved_in_bytes(Metaspace::MetadataType mdtype) { size_t reserved = (mdtype == Metaspace::ClassType) ? Metaspace::class_space_list()->virtual_space_total() : diff -r 32164d89fe9c -r c71879335291 src/share/vm/memory/metaspace.hpp --- a/src/share/vm/memory/metaspace.hpp Mon Dec 17 15:25:26 2012 +0100 +++ b/src/share/vm/memory/metaspace.hpp Tue Dec 18 10:40:51 2012 +0100 @@ -156,16 +156,25 @@ public: // Total of space allocated to metadata in all Metaspaces - static size_t used_in_bytes(); + static size_t used_in_bytes() { + return used_in_bytes(Metaspace::ClassType) + + used_in_bytes(Metaspace::NonClassType); + } // Total of available space in all Metaspaces // Total of capacity allocated to all Metaspaces. This includes // space in Metachunks not yet allocated and in the Metachunk // freelist. - static size_t capacity_in_bytes(); + static size_t capacity_in_bytes() { + return capacity_in_bytes(Metaspace::ClassType) + + capacity_in_bytes(Metaspace::NonClassType); + } // Total space reserved in all Metaspaces - static size_t reserved_in_bytes(); + static size_t reserved_in_bytes() { + return reserved_in_bytes(Metaspace::ClassType) + + reserved_in_bytes(Metaspace::NonClassType); + } static size_t min_chunk_size();