RFR: 8283469: Don't use memset to initialize members in FileMapInfo and fix memory leak

David Holmes dholmes at openjdk.java.net
Tue Mar 22 03:01:29 UTC 2022


On Tue, 22 Mar 2022 00:05:32 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> `FileMapInfo` uses `memset` in its constructor to initialize data member, it is generally a bad idea. It can break things badly if adds a new member with a non-trivial constructor and `memset` is not suitable.
> 
> Besides, it leaks malloc'd `_header` member.
> 
> Test:
> 
> - [x]  hotspot_cds

Isn't this one of the things we have to guarantee was zeroed at initialization to produce deterministic shared archive contents?

David

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

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


More information about the hotspot-runtime-dev mailing list