Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
ff3ccd2d
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ff3ccd2d
编写于
9月 12, 2013
作者:
E
ehelin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8023476: Metaspace capacity > reserved
Reviewed-by: stefank, hseigel, mgerdin
上级
58866ecd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
79 addition
and
84 deletion
+79
-84
src/share/vm/gc_interface/collectedHeap.cpp
src/share/vm/gc_interface/collectedHeap.cpp
+3
-3
src/share/vm/memory/metaspace.cpp
src/share/vm/memory/metaspace.cpp
+50
-33
src/share/vm/memory/metaspace.hpp
src/share/vm/memory/metaspace.hpp
+18
-40
src/share/vm/memory/metaspaceCounters.cpp
src/share/vm/memory/metaspaceCounters.cpp
+8
-8
未找到文件。
src/share/vm/gc_interface/collectedHeap.cpp
浏览文件 @
ff3ccd2d
...
...
@@ -87,15 +87,15 @@ MetaspaceSummary CollectedHeap::create_metaspace_summary() {
const
MetaspaceSizes
meta_space
(
MetaspaceAux
::
allocated_capacity_bytes
(),
MetaspaceAux
::
allocated_used_bytes
(),
MetaspaceAux
::
reserved_
in_
bytes
());
MetaspaceAux
::
reserved_bytes
());
const
MetaspaceSizes
data_space
(
MetaspaceAux
::
allocated_capacity_bytes
(
Metaspace
::
NonClassType
),
MetaspaceAux
::
allocated_used_bytes
(
Metaspace
::
NonClassType
),
MetaspaceAux
::
reserved_
in_
bytes
(
Metaspace
::
NonClassType
));
MetaspaceAux
::
reserved_bytes
(
Metaspace
::
NonClassType
));
const
MetaspaceSizes
class_space
(
MetaspaceAux
::
allocated_capacity_bytes
(
Metaspace
::
ClassType
),
MetaspaceAux
::
allocated_used_bytes
(
Metaspace
::
ClassType
),
MetaspaceAux
::
reserved_
in_
bytes
(
Metaspace
::
ClassType
));
MetaspaceAux
::
reserved_bytes
(
Metaspace
::
ClassType
));
return
MetaspaceSummary
(
meta_space
,
data_space
,
class_space
);
}
...
...
src/share/vm/memory/metaspace.cpp
浏览文件 @
ff3ccd2d
...
...
@@ -177,8 +177,8 @@ class ChunkManager VALUE_OBJ_CLASS_SPEC {
void
return_chunks
(
ChunkIndex
index
,
Metachunk
*
chunks
);
// Total of the space in the free chunks list
size_t
free_chunks_total
();
size_t
free_chunks_total_
in_
bytes
();
size_t
free_chunks_total
_words
();
size_t
free_chunks_total_bytes
();
// Number of chunks in the free chunks list
size_t
free_chunks_count
();
...
...
@@ -1080,12 +1080,12 @@ size_t VirtualSpaceList::used_words_sum() {
// Sum used region [bottom, top) in each virtualspace
allocated_by_vs
+=
vsl
->
used_words_in_vs
();
}
assert
(
allocated_by_vs
>=
chunk_manager
()
->
free_chunks_total
(),
assert
(
allocated_by_vs
>=
chunk_manager
()
->
free_chunks_total
_words
(),
err_msg
(
"Total in free chunks "
SIZE_FORMAT
" greater than total from virtual_spaces "
SIZE_FORMAT
,
allocated_by_vs
,
chunk_manager
()
->
free_chunks_total
()));
allocated_by_vs
,
chunk_manager
()
->
free_chunks_total
_words
()));
size_t
used
=
allocated_by_vs
-
chunk_manager
()
->
free_chunks_total
();
allocated_by_vs
-
chunk_manager
()
->
free_chunks_total
_words
();
return
used
;
}
...
...
@@ -1526,7 +1526,7 @@ void Metadebug::deallocate_chunk_a_lot(SpaceManager* sm,
sm
->
sum_count_in_chunks_in_use
());
dummy_chunk
->
print_on
(
gclog_or_tty
);
gclog_or_tty
->
print_cr
(
" Free chunks total %d count %d"
,
vsl
->
chunk_manager
()
->
free_chunks_total
(),
vsl
->
chunk_manager
()
->
free_chunks_total
_words
(),
vsl
->
chunk_manager
()
->
free_chunks_count
());
}
}
...
...
@@ -1583,12 +1583,12 @@ bool Metadebug::test_metadata_failure() {
// ChunkManager methods
size_t
ChunkManager
::
free_chunks_total
()
{
size_t
ChunkManager
::
free_chunks_total
_words
()
{
return
_free_chunks_total
;
}
size_t
ChunkManager
::
free_chunks_total_
in_
bytes
()
{
return
free_chunks_total
()
*
BytesPerWord
;
size_t
ChunkManager
::
free_chunks_total_bytes
()
{
return
free_chunks_total
_words
()
*
BytesPerWord
;
}
size_t
ChunkManager
::
free_chunks_count
()
{
...
...
@@ -2567,13 +2567,13 @@ size_t MetaspaceAux::used_bytes_slow(Metaspace::MetadataType mdtype) {
return
used
*
BytesPerWord
;
}
size_t
MetaspaceAux
::
free_
in_bytes
(
Metaspace
::
MetadataType
mdtype
)
{
size_t
MetaspaceAux
::
free_
bytes_slow
(
Metaspace
::
MetadataType
mdtype
)
{
size_t
free
=
0
;
ClassLoaderDataGraphMetaspaceIterator
iter
;
while
(
iter
.
repeat
())
{
Metaspace
*
msp
=
iter
.
get_next
();
if
(
msp
!=
NULL
)
{
free
+=
msp
->
free_words
(
mdtype
);
free
+=
msp
->
free_words
_slow
(
mdtype
);
}
}
return
free
*
BytesPerWord
;
...
...
@@ -2596,34 +2596,51 @@ size_t MetaspaceAux::capacity_bytes_slow(Metaspace::MetadataType mdtype) {
return
capacity
*
BytesPerWord
;
}
size_t
MetaspaceAux
::
reserved_in_bytes
(
Metaspace
::
MetadataType
mdtype
)
{
size_t
MetaspaceAux
::
capacity_bytes_slow
()
{
#ifdef PRODUCT
// Use allocated_capacity_bytes() in PRODUCT instead of this function.
guarantee
(
false
,
"Should not call capacity_bytes_slow() in the PRODUCT"
);
#endif
size_t
class_capacity
=
capacity_bytes_slow
(
Metaspace
::
ClassType
);
size_t
non_class_capacity
=
capacity_bytes_slow
(
Metaspace
::
NonClassType
);
assert
(
allocated_capacity_bytes
()
==
class_capacity
+
non_class_capacity
,
err_msg
(
"bad accounting: allocated_capacity_bytes() "
SIZE_FORMAT
" class_capacity + non_class_capacity "
SIZE_FORMAT
" class_capacity "
SIZE_FORMAT
" non_class_capacity "
SIZE_FORMAT
,
allocated_capacity_bytes
(),
class_capacity
+
non_class_capacity
,
class_capacity
,
non_class_capacity
));
return
class_capacity
+
non_class_capacity
;
}
size_t
MetaspaceAux
::
reserved_bytes
(
Metaspace
::
MetadataType
mdtype
)
{
VirtualSpaceList
*
list
=
Metaspace
::
get_space_list
(
mdtype
);
return
list
==
NULL
?
0
:
list
->
virtual_space_total
();
return
list
==
NULL
?
0
:
list
->
virtual_space_total
()
*
BytesPerWord
;
}
size_t
MetaspaceAux
::
min_chunk_size
()
{
return
Metaspace
::
first_chunk_word_size
();
}
size_t
MetaspaceAux
::
min_chunk_size
_words
()
{
return
Metaspace
::
first_chunk_word_size
();
}
size_t
MetaspaceAux
::
free_chunks_total
(
Metaspace
::
MetadataType
mdtype
)
{
size_t
MetaspaceAux
::
free_chunks_total
_words
(
Metaspace
::
MetadataType
mdtype
)
{
VirtualSpaceList
*
list
=
Metaspace
::
get_space_list
(
mdtype
);
if
(
list
==
NULL
)
{
return
0
;
}
ChunkManager
*
chunk
=
list
->
chunk_manager
();
chunk
->
slow_verify
();
return
chunk
->
free_chunks_total
();
return
chunk
->
free_chunks_total
_words
();
}
size_t
MetaspaceAux
::
free_chunks_total_
in_
bytes
(
Metaspace
::
MetadataType
mdtype
)
{
return
free_chunks_total
(
mdtype
)
*
BytesPerWord
;
size_t
MetaspaceAux
::
free_chunks_total_bytes
(
Metaspace
::
MetadataType
mdtype
)
{
return
free_chunks_total
_words
(
mdtype
)
*
BytesPerWord
;
}
size_t
MetaspaceAux
::
free_chunks_total
()
{
return
free_chunks_total
(
Metaspace
::
ClassType
)
+
free_chunks_total
(
Metaspace
::
NonClassType
);
size_t
MetaspaceAux
::
free_chunks_total
_words
()
{
return
free_chunks_total
_words
(
Metaspace
::
ClassType
)
+
free_chunks_total
_words
(
Metaspace
::
NonClassType
);
}
size_t
MetaspaceAux
::
free_chunks_total_
in_
bytes
()
{
return
free_chunks_total
()
*
BytesPerWord
;
size_t
MetaspaceAux
::
free_chunks_total_bytes
()
{
return
free_chunks_total
_words
()
*
BytesPerWord
;
}
void
MetaspaceAux
::
print_metaspace_change
(
size_t
prev_metadata_used
)
{
...
...
@@ -2634,14 +2651,14 @@ void MetaspaceAux::print_metaspace_change(size_t prev_metadata_used) {
"("
SIZE_FORMAT
")"
,
prev_metadata_used
,
allocated_used_bytes
(),
reserved_
in_
bytes
());
reserved_bytes
());
}
else
{
gclog_or_tty
->
print
(
" "
SIZE_FORMAT
"K"
"->"
SIZE_FORMAT
"K"
"("
SIZE_FORMAT
"K)"
,
prev_metadata_used
/
K
,
allocated_used_bytes
()
/
K
,
reserved_
in_bytes
()
/
K
);
prev_metadata_used
/
K
,
allocated_used_bytes
()
/
K
,
reserved_
bytes
()
/
K
);
}
gclog_or_tty
->
print
(
"]"
);
...
...
@@ -2654,14 +2671,14 @@ void MetaspaceAux::print_on(outputStream* out) {
out
->
print_cr
(
" Metaspace total "
SIZE_FORMAT
"K, used "
SIZE_FORMAT
"K,"
" reserved "
SIZE_FORMAT
"K"
,
allocated_capacity_bytes
()
/
K
,
allocated_used_bytes
()
/
K
,
reserved_
in_
bytes
()
/
K
);
allocated_capacity_bytes
()
/
K
,
allocated_used_bytes
()
/
K
,
reserved_bytes
()
/
K
);
out
->
print_cr
(
" data space "
SIZE_FORMAT
"K, used "
SIZE_FORMAT
"K,"
" reserved "
SIZE_FORMAT
"K"
,
allocated_capacity_bytes
(
nct
)
/
K
,
allocated_used_bytes
(
nct
)
/
K
,
reserved_
in_
bytes
(
nct
)
/
K
);
reserved_bytes
(
nct
)
/
K
);
if
(
Metaspace
::
using_class_space
())
{
Metaspace
::
MetadataType
ct
=
Metaspace
::
ClassType
;
out
->
print_cr
(
" class space "
...
...
@@ -2669,17 +2686,17 @@ void MetaspaceAux::print_on(outputStream* out) {
" reserved "
SIZE_FORMAT
"K"
,
allocated_capacity_bytes
(
ct
)
/
K
,
allocated_used_bytes
(
ct
)
/
K
,
reserved_
in_
bytes
(
ct
)
/
K
);
reserved_bytes
(
ct
)
/
K
);
}
}
// Print information for class space and data space separately.
// This is almost the same as above.
void
MetaspaceAux
::
print_on
(
outputStream
*
out
,
Metaspace
::
MetadataType
mdtype
)
{
size_t
free_chunks_capacity_bytes
=
free_chunks_total_
in_
bytes
(
mdtype
);
size_t
free_chunks_capacity_bytes
=
free_chunks_total_bytes
(
mdtype
);
size_t
capacity_bytes
=
capacity_bytes_slow
(
mdtype
);
size_t
used_bytes
=
used_bytes_slow
(
mdtype
);
size_t
free_bytes
=
free_
in_bytes
(
mdtype
);
size_t
free_bytes
=
free_
bytes_slow
(
mdtype
);
size_t
used_and_free
=
used_bytes
+
free_bytes
+
free_chunks_capacity_bytes
;
out
->
print_cr
(
" Chunk accounting: used in chunks "
SIZE_FORMAT
...
...
@@ -3132,7 +3149,7 @@ size_t Metaspace::used_words_slow(MetadataType mdtype) const {
}
}
size_t
Metaspace
::
free_words
(
MetadataType
mdtype
)
const
{
size_t
Metaspace
::
free_words
_slow
(
MetadataType
mdtype
)
const
{
if
(
mdtype
==
ClassType
)
{
return
using_class_space
()
?
class_vsm
()
->
sum_free_in_chunks_in_use
()
:
0
;
}
else
{
...
...
src/share/vm/memory/metaspace.hpp
浏览文件 @
ff3ccd2d
...
...
@@ -182,9 +182,8 @@ class Metaspace : public CHeapObj<mtClass> {
char
*
bottom
()
const
;
size_t
used_words_slow
(
MetadataType
mdtype
)
const
;
size_t
free_words
(
MetadataType
mdtype
)
const
;
size_t
free_words
_slow
(
MetadataType
mdtype
)
const
;
size_t
capacity_words_slow
(
MetadataType
mdtype
)
const
;
size_t
waste_words
(
MetadataType
mdtype
)
const
;
size_t
used_bytes_slow
(
MetadataType
mdtype
)
const
;
size_t
capacity_bytes_slow
(
MetadataType
mdtype
)
const
;
...
...
@@ -221,19 +220,14 @@ class Metaspace : public CHeapObj<mtClass> {
};
class
MetaspaceAux
:
AllStatic
{
static
size_t
free_chunks_total
(
Metaspace
::
MetadataType
mdtype
);
public:
// Statistics for class space and data space in metaspace.
static
size_t
free_chunks_total_words
(
Metaspace
::
MetadataType
mdtype
);
// These methods iterate over the classloader data graph
// for the given Metaspace type. These are slow.
static
size_t
used_bytes_slow
(
Metaspace
::
MetadataType
mdtype
);
static
size_t
free_
in_bytes
(
Metaspace
::
MetadataType
mdtype
);
static
size_t
free_
bytes_slow
(
Metaspace
::
MetadataType
mdtype
);
static
size_t
capacity_bytes_slow
(
Metaspace
::
MetadataType
mdtype
);
// Iterates over the virtual space list.
static
size_t
reserved_in_bytes
(
Metaspace
::
MetadataType
mdtype
);
static
size_t
capacity_bytes_slow
();
// Running sum of space in all Metachunks that has been
// allocated to a Metaspace. This is used instead of
...
...
@@ -263,17 +257,16 @@ class MetaspaceAux : AllStatic {
}
// Used by MetaspaceCounters
static
size_t
free_chunks_total
();
static
size_t
free_chunks_total_
in_
bytes
();
static
size_t
free_chunks_total_
in_
bytes
(
Metaspace
::
MetadataType
mdtype
);
static
size_t
free_chunks_total
_words
();
static
size_t
free_chunks_total_bytes
();
static
size_t
free_chunks_total_bytes
(
Metaspace
::
MetadataType
mdtype
);
static
size_t
allocated_capacity_words
(
Metaspace
::
MetadataType
mdtype
)
{
return
_allocated_capacity_words
[
mdtype
];
}
static
size_t
allocated_capacity_words
()
{
return
_allocated_capacity_words
[
Metaspace
::
NonClassType
]
+
(
Metaspace
::
using_class_space
()
?
_allocated_capacity_words
[
Metaspace
::
ClassType
]
:
0
);
return
allocated_capacity_words
(
Metaspace
::
NonClassType
)
+
allocated_capacity_words
(
Metaspace
::
ClassType
);
}
static
size_t
allocated_capacity_bytes
(
Metaspace
::
MetadataType
mdtype
)
{
return
allocated_capacity_words
(
mdtype
)
*
BytesPerWord
;
...
...
@@ -286,9 +279,8 @@ class MetaspaceAux : AllStatic {
return
_allocated_used_words
[
mdtype
];
}
static
size_t
allocated_used_words
()
{
return
_allocated_used_words
[
Metaspace
::
NonClassType
]
+
(
Metaspace
::
using_class_space
()
?
_allocated_used_words
[
Metaspace
::
ClassType
]
:
0
);
return
allocated_used_words
(
Metaspace
::
NonClassType
)
+
allocated_used_words
(
Metaspace
::
ClassType
);
}
static
size_t
allocated_used_bytes
(
Metaspace
::
MetadataType
mdtype
)
{
return
allocated_used_words
(
mdtype
)
*
BytesPerWord
;
...
...
@@ -301,31 +293,17 @@ class MetaspaceAux : AllStatic {
static
size_t
free_bytes
(
Metaspace
::
MetadataType
mdtype
);
// Total capacity in all Metaspaces
static
size_t
capacity_bytes_slow
()
{
#ifdef PRODUCT
// Use allocated_capacity_bytes() in PRODUCT instead of this function.
guarantee
(
false
,
"Should not call capacity_bytes_slow() in the PRODUCT"
);
#endif
size_t
class_capacity
=
capacity_bytes_slow
(
Metaspace
::
ClassType
);
size_t
non_class_capacity
=
capacity_bytes_slow
(
Metaspace
::
NonClassType
);
assert
(
allocated_capacity_bytes
()
==
class_capacity
+
non_class_capacity
,
err_msg
(
"bad accounting: allocated_capacity_bytes() "
SIZE_FORMAT
" class_capacity + non_class_capacity "
SIZE_FORMAT
" class_capacity "
SIZE_FORMAT
" non_class_capacity "
SIZE_FORMAT
,
allocated_capacity_bytes
(),
class_capacity
+
non_class_capacity
,
class_capacity
,
non_class_capacity
));
return
class_capacity
+
non_class_capacity
;
static
size_t
reserved_bytes
(
Metaspace
::
MetadataType
mdtype
);
static
size_t
reserved_bytes
()
{
return
reserved_bytes
(
Metaspace
::
ClassType
)
+
reserved_bytes
(
Metaspace
::
NonClassType
);
}
// Total space reserved in all Metaspaces
static
size_t
reserved_in_bytes
()
{
return
reserved_in_bytes
(
Metaspace
::
ClassType
)
+
reserved_in_bytes
(
Metaspace
::
NonClassType
);
static
size_t
min_chunk_size_words
();
static
size_t
min_chunk_size_bytes
()
{
return
min_chunk_size_words
()
*
BytesPerWord
;
}
static
size_t
min_chunk_size
();
// Print change in used metadata.
static
void
print_metaspace_change
(
size_t
prev_metadata_used
);
static
void
print_on
(
outputStream
*
out
);
...
...
src/share/vm/memory/metaspaceCounters.cpp
浏览文件 @
ff3ccd2d
...
...
@@ -71,7 +71,7 @@ size_t MetaspaceCounters::calculate_capacity() {
// 2) unused space at the end of each Metachunk
// 3) space in the freelist
size_t
total_capacity
=
MetaspaceAux
::
allocated_capacity_bytes
()
+
MetaspaceAux
::
free_bytes
()
+
MetaspaceAux
::
free_chunks_total_
in_
bytes
();
+
MetaspaceAux
::
free_bytes
()
+
MetaspaceAux
::
free_chunks_total_bytes
();
return
total_capacity
;
}
...
...
@@ -79,9 +79,9 @@ void MetaspaceCounters::initialize_performance_counters() {
if
(
UsePerfData
)
{
assert
(
_perf_counters
==
NULL
,
"Should only be initialized once"
);
size_t
min_capacity
=
MetaspaceAux
::
min_chunk_size
();
size_t
min_capacity
=
MetaspaceAux
::
min_chunk_size
_bytes
();
size_t
capacity
=
calculate_capacity
();
size_t
max_capacity
=
MetaspaceAux
::
reserved_
in_
bytes
();
size_t
max_capacity
=
MetaspaceAux
::
reserved_bytes
();
size_t
used
=
MetaspaceAux
::
allocated_used_bytes
();
_perf_counters
=
new
MetaspacePerfCounters
(
"metaspace"
,
min_capacity
,
capacity
,
max_capacity
,
used
);
...
...
@@ -93,7 +93,7 @@ void MetaspaceCounters::update_performance_counters() {
assert
(
_perf_counters
!=
NULL
,
"Should be initialized"
);
size_t
capacity
=
calculate_capacity
();
size_t
max_capacity
=
MetaspaceAux
::
reserved_
in_
bytes
();
size_t
max_capacity
=
MetaspaceAux
::
reserved_bytes
();
size_t
used
=
MetaspaceAux
::
allocated_used_bytes
();
_perf_counters
->
update
(
capacity
,
max_capacity
,
used
);
...
...
@@ -105,7 +105,7 @@ MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL;
size_t
CompressedClassSpaceCounters
::
calculate_capacity
()
{
return
MetaspaceAux
::
allocated_capacity_bytes
(
_class_type
)
+
MetaspaceAux
::
free_bytes
(
_class_type
)
+
MetaspaceAux
::
free_chunks_total_
in_
bytes
(
_class_type
);
MetaspaceAux
::
free_chunks_total_bytes
(
_class_type
);
}
void
CompressedClassSpaceCounters
::
update_performance_counters
()
{
...
...
@@ -113,7 +113,7 @@ void CompressedClassSpaceCounters::update_performance_counters() {
assert
(
_perf_counters
!=
NULL
,
"Should be initialized"
);
size_t
capacity
=
calculate_capacity
();
size_t
max_capacity
=
MetaspaceAux
::
reserved_
in_
bytes
(
_class_type
);
size_t
max_capacity
=
MetaspaceAux
::
reserved_bytes
(
_class_type
);
size_t
used
=
MetaspaceAux
::
allocated_used_bytes
(
_class_type
);
_perf_counters
->
update
(
capacity
,
max_capacity
,
used
);
...
...
@@ -126,9 +126,9 @@ void CompressedClassSpaceCounters::initialize_performance_counters() {
const
char
*
ns
=
"compressedclassspace"
;
if
(
UseCompressedClassPointers
)
{
size_t
min_capacity
=
MetaspaceAux
::
min_chunk_size
();
size_t
min_capacity
=
MetaspaceAux
::
min_chunk_size
_bytes
();
size_t
capacity
=
calculate_capacity
();
size_t
max_capacity
=
MetaspaceAux
::
reserved_
in_
bytes
(
_class_type
);
size_t
max_capacity
=
MetaspaceAux
::
reserved_bytes
(
_class_type
);
size_t
used
=
MetaspaceAux
::
allocated_used_bytes
(
_class_type
);
_perf_counters
=
new
MetaspacePerfCounters
(
ns
,
min_capacity
,
capacity
,
max_capacity
,
used
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录