Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
281e84a2
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看板
提交
281e84a2
编写于
6月 10, 2015
作者:
J
jwilhelm
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
81010277
316633bb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
55 deletion
+7
-55
src/share/vm/memory/metaspace.cpp
src/share/vm/memory/metaspace.cpp
+7
-55
未找到文件。
src/share/vm/memory/metaspace.cpp
浏览文件 @
281e84a2
...
...
@@ -622,7 +622,8 @@ class SpaceManager : public CHeapObj<mtClass> {
Metachunk
*
_chunks_in_use
[
NumberOfInUseLists
];
Metachunk
*
_current_chunk
;
// Maximum number of small chunks to allocate to a SpaceManager
// Number of small chunks to allocate to a manager
// If class space manager, small chunks are unlimited
static
uint
const
_small_chunk_limit
;
// Sum of all space in allocated chunks
...
...
@@ -736,8 +737,6 @@ class SpaceManager : public CHeapObj<mtClass> {
// Block allocation and deallocation.
// Allocates a block from the current chunk
MetaWord
*
allocate
(
size_t
word_size
);
// Allocates a block from a small chunk
MetaWord
*
get_small_chunk_and_allocate
(
size_t
word_size
);
// Helper for allocations
MetaWord
*
allocate_work
(
size_t
word_size
);
...
...
@@ -2032,8 +2031,9 @@ void SpaceManager::locked_print_chunks_in_use_on(outputStream* st) const {
size_t
SpaceManager
::
calc_chunk_size
(
size_t
word_size
)
{
// Decide between a small chunk and a medium chunk. Up to
// _small_chunk_limit small chunks can be allocated.
// After that a medium chunk is preferred.
// _small_chunk_limit small chunks can be allocated but
// once a medium chunk has been allocated, no more small
// chunks will be allocated.
size_t
chunk_word_size
;
if
(
chunks_in_use
(
MediumIndex
)
==
NULL
&&
sum_count_in_chunks_in_use
(
SmallIndex
)
<
_small_chunk_limit
)
{
...
...
@@ -2101,7 +2101,7 @@ MetaWord* SpaceManager::grow_and_allocate(size_t word_size) {
word_size
,
words_used
,
words_left
);
}
// Get another chunk
// Get another chunk
out of the virtual space
size_t
grow_chunks_by_words
=
calc_chunk_size
(
word_size
);
Metachunk
*
next
=
get_new_chunk
(
word_size
,
grow_chunks_by_words
);
...
...
@@ -2432,43 +2432,6 @@ Metachunk* SpaceManager::get_new_chunk(size_t word_size,
return
next
;
}
/*
* The policy is to allocate up to _small_chunk_limit small chunks
* after which only medium chunks are allocated. This is done to
* reduce fragmentation. In some cases, this can result in a lot
* of small chunks being allocated to the point where it's not
* possible to expand. If this happens, there may be no medium chunks
* available and OOME would be thrown. Instead of doing that,
* if the allocation request size fits in a small chunk, an attempt
* will be made to allocate a small chunk.
*/
MetaWord
*
SpaceManager
::
get_small_chunk_and_allocate
(
size_t
word_size
)
{
if
(
word_size
+
Metachunk
::
overhead
()
>
small_chunk_size
())
{
return
NULL
;
}
MutexLockerEx
cl
(
lock
(),
Mutex
::
_no_safepoint_check_flag
);
MutexLockerEx
cl1
(
expand_lock
(),
Mutex
::
_no_safepoint_check_flag
);
Metachunk
*
chunk
=
chunk_manager
()
->
chunk_freelist_allocate
(
small_chunk_size
());
MetaWord
*
mem
=
NULL
;
if
(
chunk
!=
NULL
)
{
// Add chunk to the in-use chunk list and do an allocation from it.
// Add to this manager's list of chunks in use.
add_chunk
(
chunk
,
false
);
mem
=
chunk
->
allocate
(
word_size
);
inc_used_metrics
(
word_size
);
// Track metaspace memory usage statistic.
track_metaspace_memory_usage
();
}
return
mem
;
}
MetaWord
*
SpaceManager
::
allocate
(
size_t
word_size
)
{
MutexLockerEx
cl
(
lock
(),
Mutex
::
_no_safepoint_check_flag
);
...
...
@@ -3548,18 +3511,7 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
}
if
(
result
==
NULL
)
{
SpaceManager
*
sm
;
if
(
is_class_space_allocation
(
mdtype
))
{
sm
=
loader_data
->
metaspace_non_null
()
->
class_vsm
();
}
else
{
sm
=
loader_data
->
metaspace_non_null
()
->
vsm
();
}
result
=
sm
->
get_small_chunk_and_allocate
(
word_size
);
if
(
result
==
NULL
)
{
report_metadata_oome
(
loader_data
,
word_size
,
type
,
mdtype
,
CHECK_NULL
);
}
report_metadata_oome
(
loader_data
,
word_size
,
type
,
mdtype
,
CHECK_NULL
);
}
// Zero initialize.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录