RFR: 8282469: Allow considered use of C++ thread_local in Hotspot
Daniel D.Daugherty
dcubed at openjdk.java.net
Tue Mar 8 21:36:08 UTC 2022
On Mon, 7 Mar 2022 21:21:28 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/memory/operator_new.cpp line 37:
>>
>>> 35: // a memory leak. Use CHeapObj as the base class of such objects to make it explicit
>>> 36: // that they're allocated on the C heap.
>>> 37: // Commented out in product version to avoid conflicts with third-party C++ native code.
>>
>> There's a little bit of policy information here that is being deleted. It overlaps with the section `### Memory Allocation` in `hotspot-style.md`, but includes this information which might not be stated elsewhere:
>>
>>> Typically, uses of the C++ global operator new are inadvertent and therefore often associated with memory leaks.
>>
>> (This is my rephrasing, perhaps appropriate to the style guide.)
>>
>> Or is a point like this made in the config file which prevents direct linkage? (I don't know where that file is.)
>
> The link-time check is expressed in open/make/hotspot/lib/CompileJvm.gmk but simply states:
>
>
> # Hotspot disallows the use of global operators 'new' and 'delete'. This build
> # time check helps enforce this requirement. ...
>
>
> The prohibition on using global operator new should definitely be explicitly documented somewhere, so the style guide seems a suitable place.
I agree that the prohibition on using global operator new should definitely be explicitly documented somewhere and I'm good with adding that warning to the HotSpot style guide.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7719
More information about the hotspot-dev
mailing list