diff -r d7304cf430f1 -r 9d82a35b6ff7 src/hotspot/share/memory/filemap.cpp --- a/src/hotspot/share/memory/filemap.cpp Mon Jul 29 18:22:55 2019 +0200 +++ b/src/hotspot/share/memory/filemap.cpp Mon Jul 29 09:59:04 2019 -0700 @@ -1771,7 +1771,9 @@ } init_from_file(_fd, is_static); - if (!validate_header(is_static)) { + // UseSharedSpaces could be disabled if the checking of some of the header fields in + // init_from_file has failed. + if (!UseSharedSpaces || !validate_header(is_static)) { return false; } return true;