[15] RFR(XS): 8244946: fatal error: memory leak: allocating without ResourceMark with -XX:+Verbose -Xlog:methodhandles
David Holmes
david.holmes at oracle.com
Wed May 13 23:51:55 UTC 2020
Hi Christian,
On 14/05/2020 1:10 am, Christian Hagedorn wrote:
> Hi
>
> Please review the following patch:
> https://bugs.openjdk.java.net/browse/JDK-8244946
> http://cr.openjdk.java.net/~chagedorn/8244946/webrev.00/
>
> This simply fixes a missing ResourceMark required to call
> Klass::oop_print_on().
>
> The reason for the missing ResourceMark in oop_print_on() is stated in
> the RFR [1] for JDK-8222893 [2] which removed the ResourceMark due to a
> bug:
>
> "print functions with outputStream should not have a ResourceMark
> because you could call it with a LogStream or stream that was allocated
> outside the resource mark. The caller needs the ResourceMark."
src/hotspot/cpu/x86/methodHandles_x86.cpp
Given all of the code is inside:
504 if (Verbose) {
I would just move the ResourceMark to the top of that block. We are
going to use it unconditionally, and we are not releasing it until the
end of the method regardless. That avoids the potential concern Dan
raised about extending the scope of the PRESERVE_EXCEPTION_MARK.
> There are other places like Klass::print_on(outputStream*) where this is
> still the case. Should we file an RFE to clean these up?
Obviously we don't have any tests running in a mode that causes this
code to be executed, so yes it is probably a good idea to take a closer
look at other call-sites and file a RFE if needed.
Thanks,
David
-----
> Thank you!
>
> Best regards,
> Christian
>
>
> [1]
> https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2019-May/034095.html
>
> [2] https://bugs.openjdk.java.net/browse/JDK-8222893
More information about the hotspot-dev
mailing list