RFR: JDK-8277822: Remove debug-only heap overrun checks in os::malloc and friends [v3]

Thomas Stuefe stuefe at openjdk.java.net
Fri Jan 14 19:33:31 UTC 2022


On Fri, 14 Jan 2022 18:53:56 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/runtime/os.cpp line 622:
>> 
>>> 620: static void break_if_ptr_caught(void* ptr) {
>>> 621:   if (p2i(ptr) == (intptr_t)MallocCatchPtr) {
>>> 622:     log_warning(malloc, free)("ptr caught: " PTR_FORMAT, p2i(ptr));
>> 
>> If this is the same as MallocCatchPtr, doesn't this output simply print MallocCatchPtr?
>
> I don't understand what this does. ie. please tell what it does in a comment.

> If this is the same as MallocCatchPtr, doesn't this output simply print MallocCatchPtr?

Yes

> I don't understand what this does. ie. please tell what it does in a comment.

Oh, I did not invent it, I just unified the various places where before we checked MallocCatchPtr. E.g. here: https://github.com/openjdk/jdk/blob/fb8fdc0fbf17dd7e900cb688df4917b97b26b9ab/src/hotspot/share/runtime/os.cpp#L700-L703 

The coding is old, I believe it predates the OpenJDK. I would love to get rid of MallocCatchPtr, if nobody uses it anymore.

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

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


More information about the hotspot-runtime-dev mailing list