On Fri, 14 Jan 2022 12:52:11 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:

>> 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.
>
> This is not as trivial, AFAICS. Note that the existing code `delete fs` after 
> checking `if (os != NULL && os != out)`. Does it mean this patch can 
> effectively `delete out`? Or can it call `delete nullptr`?

Thanks, @shipilev  and @sspitsyn !

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

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

Reply via email to