diff --git a/src/hotspot/share/code/codeCache.hpp b/src/hotspot/share/code/codeCache.hpp index 04e808fa2ef..19eba85914d 100644 --- a/src/hotspot/share/code/codeCache.hpp +++ b/src/hotspot/share/code/codeCache.hpp @@ -380,6 +380,10 @@ template class CodeBlobIterator : publi : _only_not_unloading(filter == only_not_unloading) { if (Filter::heaps() == NULL) { + // The iterator is supposed to shortcut since we have + // _heap == _end, but make sure we do not have garbage + // in other fields as well. + _code_blob = nullptr; return; } _heap = Filter::heaps()->begin();