8149557: Resource mark breaks printing to string stream
Reviewed-by: stuefe, dholmes
This commit is contained in:
parent
750d6c1bb6
commit
8a70bcf857
@ -158,9 +158,21 @@ void Symbol::print_utf8_on(outputStream* st) const {
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -338,7 +338,9 @@ void stringStream::write(const char* s, size_t len) {
|
||||
}
|
||||
char* oldbuf = buffer;
|
||||
assert(rm == NULL || Thread::current()->current_resource_mark() == rm,
|
||||
"stringStream is re-allocated with a different ResourceMark");
|
||||
"StringStream is re-allocated with a different ResourceMark. Current: "
|
||||
PTR_FORMAT " original: " PTR_FORMAT,
|
||||
p2i(Thread::current()->current_resource_mark()), p2i(rm));
|
||||
buffer = NEW_RESOURCE_ARRAY(char, end);
|
||||
if (buffer_pos > 0) {
|
||||
memcpy(buffer, oldbuf, buffer_pos);
|
||||
|
Loading…
x
Reference in New Issue
Block a user