(11) RFR (S) JDK-8196880: VS2017 Addition of Global Delete Operator with Size Parameter Conflicts with Arena's Chunk Provided One
Lois Foltan
lois.foltan at oracle.com
Wed Feb 14 17:14:34 UTC 2018
On 2/14/2018 9:26 AM, Thomas Stüfe wrote:
> Hi Lois,
>
> thanks for fixing this!
Thanks for the review!
>
> Small nit, not part of your patch, but still:
>
> Chunks get allocated via CHeapObj::operator new() but deleted in
> Chunk::chop() with raw ::free(). Would it not be cleaner to call
> CHeapObj::operator delete() instead (it does a free() too, but that
> would be symmetrical? That would require that we actually implement
> Chunk::operator delete(), I guess.
Sure, that seems reasonable and logical. However, note it still doesn't
alleviate the need to define a delete operator that takes a size
parameter. At the point where placement new is used, the compiler tries
to find an appropriate matching operator delete and would error (C4291)
with a failure to find one if not provided.
Thanks,
Lois
>
> Best Regards, Thomas
>
>
> On Wed, Feb 14, 2018 at 2:48 PM, Lois Foltan <lois.foltan at oracle.com
> <mailto:lois.foltan at oracle.com>> wrote:
>
> Please review this change in VS2017 to the delete operator due to
> C++14 standard conformance. From
> https://msdn.microsoft.com/en-us/library/mt723604.aspx
> <https://msdn.microsoft.com/en-us/library/mt723604.aspx>
>
> The function|void operator delete(void *, size_t)|was a placement
> delete operator corresponding to the placement new function "void
> * operator new(size_t, size_t)" in C++11. With C++14 sized
> deallocation, this delete function is now a/usual deallocation
> function/(global delete operator). The standard requires that if
> the use of a placement new looks up a corresponding delete
> function and finds a usual deallocation function, the program is
> ill-formed.
>
> Thank you to Kim Barrett for proposing the fix below.
>
> open webrev at
> http://cr.openjdk.java.net/~lfoltan/bug_jdk8196880/webrev/
> <http://cr.openjdk.java.net/%7Elfoltan/bug_jdk8196880/webrev/>
> bug link https://bugs.openjdk.java.net/browse/JDK-8196880
> <https://bugs.openjdk.java.net/browse/JDK-8196880>
>
> Testing complete (hs-tier1-3, jdk-tier1-3)
>
> Thanks,
> Lois
>
>
>
More information about the hotspot-dev
mailing list