RFR: 8298321: 2 File Leak defect groups in 2 files [v2]

Ioi Lam iklam at openjdk.org
Mon Jan 9 23:16:54 UTC 2023


On Mon, 9 Jan 2023 23:08:39 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Please review this simple change for fixing two file leak warnings: 
>> 1) DirectivesParser::parse_from_file_inner() in open/src/hotspot/share/compiler/directivesParser.cpp 
>> 2) mmap_attach_shared() in open/src/hotspot/os/posix/perfMemory_posix.cpp
>> 
>> Please refer to the [comment](https://bugs.openjdk.org/browse/JDK-8298321?focusedCommentId=14549361&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14549361) in the bug report for details.
>> 
>> Passed tiers 1 and 2 testing.
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   add an assert in perfMemory_posix.cpp

src/hotspot/os/posix/perfMemory_posix.cpp line 1211:

> 1209:     return;
> 1210:   }
> 1211:   assert(!HAS_PENDING_EXCEPTION, "must be");

I think this is better, so you don't need to read the rather convoluted code in open_sharedmem_file() to understand what the API contract is.

if (HAS_PENDING_EXCEPTION) {
  assert(fd == OS_ERR, "open_sharedmem_file always returns OS_ERR on exceptions");
}
if (fd == OS_ERR) {
  return;
}

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

PR: https://git.openjdk.org/jdk/pull/11909


More information about the hotspot-dev mailing list