RFR: JDK-8280002: jmap -histo may leak stream

Thomas Stuefe stuefe at openjdk.java.net
Fri Jan 14 10:10:50 UTC 2022


Very trivial fix to a handle/memory leak. 

JDK-8215624 added parallel heap iteration to both `jmap -histo` and `jcmd GC.class_histogram`. When called with an explicit file and an invalid argument for number of threads, it leaks the file (bit of memory and a handle).

Reproduce with:

`jmap -histo:parallel=notanumber,file=xx.txt`

Can only be reproduced with jmap. jcmd is safe, arguments are handled correctly in shared code.

-------------

Commit messages:
 - delete stream

Changes: https://git.openjdk.java.net/jdk/pull/7078/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7078&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8280002
  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7078.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7078/head:pull/7078

PR: https://git.openjdk.java.net/jdk/pull/7078


More information about the serviceability-dev mailing list