Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
96dea4ec
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
96dea4ec
编写于
5月 06, 2013
作者:
Z
zgu
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
10c8736d
5bfa7e7e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
85 addition
and
6 deletion
+85
-6
src/share/vm/memory/allocation.inline.hpp
src/share/vm/memory/allocation.inline.hpp
+1
-1
src/share/vm/runtime/os.cpp
src/share/vm/runtime/os.cpp
+12
-0
src/share/vm/runtime/os.hpp
src/share/vm/runtime/os.hpp
+2
-0
src/share/vm/services/memSnapshot.cpp
src/share/vm/services/memSnapshot.cpp
+20
-5
test/runtime/NMT/ReleaseCommittedMemory.java
test/runtime/NMT/ReleaseCommittedMemory.java
+50
-0
未找到文件。
src/share/vm/memory/allocation.inline.hpp
浏览文件 @
96dea4ec
...
...
@@ -132,7 +132,7 @@ E* ArrayAllocator<E, F>::allocate(size_t length) {
int
alignment
=
os
::
vm_allocation_granularity
();
_size
=
align_size_up
(
_size
,
alignment
);
_addr
=
os
::
reserve_memory
(
_size
,
NULL
,
alignment
);
_addr
=
os
::
reserve_memory
(
_size
,
NULL
,
alignment
,
F
);
if
(
_addr
==
NULL
)
{
vm_exit_out_of_memory
(
_size
,
OOM_MMAP_ERROR
,
"Allocator (reserve)"
);
}
...
...
src/share/vm/runtime/os.cpp
浏览文件 @
96dea4ec
...
...
@@ -1457,6 +1457,18 @@ char* os::reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
return
result
;
}
char
*
os
::
reserve_memory
(
size_t
bytes
,
char
*
addr
,
size_t
alignment_hint
,
MEMFLAGS
flags
)
{
char
*
result
=
pd_reserve_memory
(
bytes
,
addr
,
alignment_hint
);
if
(
result
!=
NULL
)
{
MemTracker
::
record_virtual_memory_reserve
((
address
)
result
,
bytes
,
CALLER_PC
);
MemTracker
::
record_virtual_memory_type
((
address
)
result
,
flags
);
}
return
result
;
}
char
*
os
::
attempt_reserve_memory_at
(
size_t
bytes
,
char
*
addr
)
{
char
*
result
=
pd_attempt_reserve_memory_at
(
bytes
,
addr
);
if
(
result
!=
NULL
)
{
...
...
src/share/vm/runtime/os.hpp
浏览文件 @
96dea4ec
...
...
@@ -255,6 +255,8 @@ class os: AllStatic {
static
int
vm_allocation_granularity
();
static
char
*
reserve_memory
(
size_t
bytes
,
char
*
addr
=
0
,
size_t
alignment_hint
=
0
);
static
char
*
reserve_memory
(
size_t
bytes
,
char
*
addr
,
size_t
alignment_hint
,
MEMFLAGS
flags
);
static
char
*
reserve_memory_aligned
(
size_t
size
,
size_t
alignment
);
static
char
*
attempt_reserve_memory_at
(
size_t
bytes
,
char
*
addr
);
static
void
split_reserved_memory
(
char
*
base
,
size_t
size
,
...
...
src/share/vm/services/memSnapshot.cpp
浏览文件 @
96dea4ec
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -262,13 +262,28 @@ bool VMMemPointerIterator::remove_released_region(MemPointerRecord* rec) {
assert
(
cur
->
is_reserved_region
()
&&
cur
->
contains_region
(
rec
),
"Sanity check"
);
if
(
rec
->
is_same_region
(
cur
))
{
// release whole reserved region
// In snapshot, the virtual memory records are sorted in following orders:
// 1. virtual memory's base address
// 2. virtual memory reservation record, followed by commit records within this reservation.
// The commit records are also in base address order.
// When a reserved region is released, we want to remove the reservation record and all
// commit records following it.
#ifdef ASSERT
VMMemRegion
*
next_region
=
(
VMMemRegion
*
)
peek_next
();
// should not have any committed memory in this reserved region
assert
(
next_region
==
NULL
||
!
next_region
->
is_committed_region
(),
"Sanity check"
);
address
low_addr
=
cur
->
addr
();
address
high_addr
=
low_addr
+
cur
->
size
();
#endif
// remove virtual memory reservation record
remove
();
// remove committed regions within above reservation
VMMemRegion
*
next_region
=
(
VMMemRegion
*
)
current
();
while
(
next_region
!=
NULL
&&
next_region
->
is_committed_region
())
{
assert
(
next_region
->
addr
()
>=
low_addr
&&
next_region
->
addr
()
+
next_region
->
size
()
<=
high_addr
,
"Range check"
);
remove
();
next_region
=
(
VMMemRegion
*
)
current
();
}
}
else
if
(
rec
->
addr
()
==
cur
->
addr
()
||
rec
->
addr
()
+
rec
->
size
()
==
cur
->
addr
()
+
cur
->
size
())
{
// released region is at either end of this region
...
...
test/runtime/NMT/ReleaseCommittedMemory.java
0 → 100644
浏览文件 @
96dea4ec
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8013120
* @summary Release committed memory and make sure NMT handles it correctly
* @key nmt regression
* @library /testlibrary /testlibrary/whitebox
* @build ReleaseCommittedMemory
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ReleaseCommittedMemory
*/
import
sun.hotspot.WhiteBox
;
public
class
ReleaseCommittedMemory
{
public
static
void
main
(
String
args
[])
throws
Exception
{
WhiteBox
wb
=
WhiteBox
.
getWhiteBox
();
long
reserveSize
=
256
*
1024
;
long
addr
;
addr
=
wb
.
NMTReserveMemory
(
reserveSize
);
wb
.
NMTCommitMemory
(
addr
,
128
*
1024
);
wb
.
NMTReleaseMemory
(
addr
,
reserveSize
);
wb
.
NMTWaitForDataMerge
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录