RFR: 8273414: ResourceObj::operator delete should handle nullptr in debug builds
Thomas Stuefe
stuefe at openjdk.java.net
Tue Sep 7 10:00:45 UTC 2021
On Tue, 7 Sep 2021 09:40:33 GMT, Leo Korinth <lkorinth at openjdk.org> wrote:
> This is how delete usually works, This is also how FreeHeap and CHeapObj::operator delete works. Delete does handle nullptr in release builds, it is the assert that may crash. Also, as a user it is nice to call delete without first checking the argument for nullptr.
Seems good and trivial.
However, unrelated to this change, I think operator delete should also work for RA-allocated objects. It should call Arena::Afree() to release the memory if it happens to be on top of the arena.
At some point we may also improve the arenas and add some form of free block handling for Arena::Afree(), like Metaspace arenas already do. In that case, it would also be able to reclaim memory not on top of the arena.
Cheers, Thomas
-------------
Marked as reviewed by stuefe (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/5385
More information about the hotspot-runtime-dev
mailing list