diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index 1512f498b37cb..686459c65e146 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -206,6 +206,8 @@ void CodeBlob::purge() { if (_mutable_data != blob_end()) { os::free(_mutable_data); _mutable_data = blob_end(); // Valid not null address + _mutable_data_size = 0; + _relocation_size = 0; } if (_oop_maps != nullptr) { delete _oop_maps; diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index ed6167dac225b..1ee7ebd14ec1c 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -2169,6 +2169,7 @@ void nmethod::purge(bool unregister_nmethod) { } CodeCache::unregister_old_nmethod(this); + JVMCI_ONLY( _metadata_size = 0; ) CodeBlob::purge(); }