Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
/ jdk13u-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: 6df465d
  • Loading branch information
Ekaterina Vergizova authored and Yuri Nesterenko committed Jan 26, 2021
1 parent 0bb1017 commit 614325c
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 @@ -43,6 +43,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 614325c

@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.