--- old/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java 2018-09-14 12:56:05.233413382 -0400 +++ new/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java 2018-09-14 12:56:03.825333045 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -181,7 +181,13 @@ public void run() { System.out.println("Start the thread " + threadId); while (TestStressIHOPMultiThread.this.isRunning()) { - allocate(amountOfGarbage); + try { + allocate(amountOfGarbage); + } catch (OutOfMemoryError e) { + free(); + System.out.println("OutOfMemoryError occurred in thread " + threadId); + break; + } free(); } }