--- old/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp 2018-09-03 12:51:03.119851996 +0200 +++ new/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp 2018-09-03 12:51:02.725840014 +0200 @@ -170,7 +170,9 @@ // Given that this survivor space is not used, we update it here // once to reflect that its used space is 0 so that we don't have to // worry about updating it again later. - _from_space_counters->update_used(0); + if (UsePerfData) { + _from_space_counters->update_used(0); + } // name "generation.0.space.2" // See _old_space_counters for additional counters --- /dev/null 2018-09-03 10:20:47.231578297 +0200 +++ new/test/hotspot/jtreg/gc/TestNoPerfCounter.java 2018-09-03 12:51:04.301887945 +0200 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test TestNoPerfCounter + * @bug 8210265 + * @requires vm.gc=="null" + * @library /test/lib / + * @summary Tests that disabling perf counters does not crash the VM + * @run main/othervm -XX:-UsePerfData TestNoPerfCounter + */ + +public class TestNoPerfCounter { + public static void main(String[] args) throws Exception { + // Nothing to do + } +}