Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
/ jdk15u-dev Public archive

Commit

Permalink
8251257: NMT: jcmd VM.native_memory scale=1 crashes target VM
Browse files Browse the repository at this point in the history
Backport-of: 6df465de7309e90bc4de8da66c7059035ffc9bef
  • Loading branch information
Ekaterina Vergizova committed May 17, 2021
1 parent fb53967 commit 723da96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/hotspot/share/services/nmtCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const char* NMTUtil::_memory_type_names[] = {

const char* NMTUtil::scale_name(size_t scale) {
switch(scale) {
case 1: return "";
case K: return "KB";
case M: return "MB";
case G: return "GB";
Expand Down
8 changes: 8 additions & 0 deletions test/hotspot/jtreg/runtime/NMT/JcmdScale.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public static void main(String args[]) throws Exception {
// Grab my own PID
String pid = Long.toString(ProcessTools.getProcessId());

pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "scale=1"});
output = new OutputAnalyzer(pb.start());
output.shouldContain(", committed=");

pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "scale=b"});
output = new OutputAnalyzer(pb.start());
output.shouldContain(", committed=");

pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "scale=KB"});
output = new OutputAnalyzer(pb.start());
output.shouldContain("KB, committed=");
Expand Down

1 comment on commit 723da96

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.