hotspot/src/share/vm/oops/symbol.cpp
changeset 36570 9608a7830fe9
parent 35898 ddc274f0052f
child 40655 9f644073d3a0
--- a/hotspot/src/share/vm/oops/symbol.cpp	Thu Mar 03 17:33:13 2016 +0000
+++ b/hotspot/src/share/vm/oops/symbol.cpp	Sun Mar 06 15:50:13 2016 -0500
@@ -158,9 +158,21 @@
 }
 
 void Symbol::print_symbol_on(outputStream* st) const {
-  ResourceMark rm;
+  char *s;
   st = st ? st : tty;
-  st->print("%s", as_quoted_ascii());
+  {
+    // ResourceMark may not affect st->print(). If st is a string
+    // stream it could resize, using the same resource arena.
+    ResourceMark rm;
+    s = as_quoted_ascii();
+    s = os::strdup(s);
+  }
+  if (s == NULL) {
+    st->print("(null)");
+  } else {
+    st->print("%s", s);
+    os::free(s);
+  }
 }
 
 char* Symbol::as_quoted_ascii() const {