diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index 81ebb08fd51..cf21f1f89a4 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -210,6 +210,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 685740e4b88..412cf222997 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -2166,6 +2166,7 @@ void nmethod::purge(bool unregister_nmethod) { } CodeCache::unregister_old_nmethod(this); + JVMCI_ONLY( _metadata_size = 0; ) CodeBlob::purge(); }