RFR: 8347758: modules.cpp leaks string returned from get_numbered_property_as_sorted_string() [v4]

David Holmes dholmes at openjdk.org
Fri Jan 17 05:15:34 UTC 2025


On Thu, 16 Jan 2025 14:04:43 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> Agreed. We detect missing ResourceMarks so there is no need to check for present ones.
>
> I added the assertion to prevent installing `ResourceMark` here, which will result in returning invalid string. @dholmes-ora suggested additional comment, but I prefer assertion.

That is not the way we generally do things. The need for a ResourceMark is part of the contract of the method hence we document it in a comment. If the caller fails to provide one then we get an assertion failure. We don't put assertions like this inside these methods to guard against putting a RM in the method itself!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23121#discussion_r1919566527


More information about the hotspot-runtime-dev mailing list