--- old/src/hotspot/share/utilities/ostream.cpp 2020-03-11 01:12:55.032412924 -0400 +++ new/src/hotspot/share/utilities/ostream.cpp 2020-03-11 01:12:53.892400250 -0400 @@ -29,6 +29,7 @@ #include "oops/oop.inline.hpp" #include "runtime/arguments.hpp" #include "runtime/os.inline.hpp" +#include "runtime/orderAccess.hpp" #include "runtime/vm_version.hpp" #include "utilities/defaultStream.hpp" #include "utilities/macros.hpp" @@ -373,6 +374,11 @@ NEW_C_HEAP_ARRAY(char, buffer_pos + 1, mtInternal) : NEW_RESOURCE_ARRAY(char, buffer_pos + 1); strncpy(copy, buffer, buffer_pos); copy[buffer_pos] = 0; // terminating null + if (c_heap) { + // Need to ensure our content is written to memory before we return + // the pointer to it. + OrderAccess::storestore(); + } return copy; }