RFR(S): 8039805: Fix the signature of the global new/delete operators in allocation.cpp

Thomas Stüfe thomas.stuefe at gmail.com
Wed Apr 9 17:50:02 UTC 2014


Hi Volker,



> This change also replaces the asserts in the operators with guarantees
> because the code may also be active in not-product (aka. 'optimized')
> builds.
>
>
I think defining global operator new in production code would be a bad
idea;
the most obvious reason would be that any third party binary loaded into
the
process space could do a new() which would trigger the guarantee.

So, I'd prefer a
 #ifndef ASSERT
 #error
 #endif
in the code...

If we really want to enable global operator new/delete for production code,
we
should provide allocations instead of guaranteeing or returning NULL.

But this still would be dangerous, mainly because it is possible that other
libraries bring their own versions of op new/delete and they may interfere
with our operators.

Kind Regards, Thomas


More information about the hotspot-dev mailing list