Mercurial > hg > icedtea7-forest > hotspot
changeset 6577:3413fb2061fb icedtea-2.7.0pre15
8138745, PR3465, RH1484399: Implement ExitOnOutOfMemory and CrashOnOutOfMemory in HotSpot
Reviewed-by: dholmes
Contributed-by: cheleswer.sahu@oracle.com
author | kevinw |
---|---|
date | Wed, 25 Oct 2017 17:09:59 +0100 |
parents | f631660ef0a3 |
children | 4e2348c9ec42 |
files | src/share/vm/runtime/globals.hpp src/share/vm/utilities/debug.cpp |
diffstat | 2 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/runtime/globals.hpp Fri Aug 11 23:51:07 2017 -0400 +++ b/src/share/vm/runtime/globals.hpp Wed Oct 25 17:09:59 2017 +0100 @@ -1247,6 +1247,13 @@ "in perm. This purely intended to allow debugging issues" \ "in production.") \ \ + product(bool, ExitOnOutOfMemoryError, false, \ + "JVM exits on the first occurrence of an out-of-memory error") \ + \ + product(bool, CrashOnOutOfMemoryError, false, \ + "JVM aborts, producing an error log and core/mini dump, on the " \ + "first occurrence of an out-of-memory error") \ + \ /* tracing */ \ \ notproduct(bool, TraceRuntimeCalls, false, \
--- a/src/share/vm/utilities/debug.cpp Fri Aug 11 23:51:07 2017 -0400 +++ b/src/share/vm/utilities/debug.cpp Wed Oct 25 17:09:59 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -317,6 +317,16 @@ VMError err(message); err.report_java_out_of_memory(); } + + if (CrashOnOutOfMemoryError) { + tty->print_cr("Aborting due to java.lang.OutOfMemoryError: %s", message); + fatal(err_msg("OutOfMemory encountered: %s", message)); + } + + if (ExitOnOutOfMemoryError) { + tty->print_cr("Terminating due to java.lang.OutOfMemoryError: %s", message); + exit(3); + } } }