mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
7143807: ResourceMark nesting problem in stringStream
Reviewed-by: kvn, dcubed
This commit is contained in:
parent
de0c86b0b4
commit
c716fa083c
5 changed files with 39 additions and 1 deletions
|
@ -296,6 +296,7 @@ stringStream::stringStream(size_t initial_size) : outputStream() {
|
|||
buffer = NEW_RESOURCE_ARRAY(char, buffer_length);
|
||||
buffer_pos = 0;
|
||||
buffer_fixed = false;
|
||||
DEBUG_ONLY(rm = Thread::current()->current_resource_mark();)
|
||||
}
|
||||
|
||||
// useful for output to fixed chunks of memory, such as performance counters
|
||||
|
@ -321,6 +322,8 @@ void stringStream::write(const char* s, size_t len) {
|
|||
end = buffer_length * 2;
|
||||
}
|
||||
char* oldbuf = buffer;
|
||||
assert(rm == NULL || Thread::current()->current_resource_mark() == rm,
|
||||
"stringStream is re-allocated with a different ResourceMark");
|
||||
buffer = NEW_RESOURCE_ARRAY(char, end);
|
||||
strncpy(buffer, oldbuf, buffer_pos);
|
||||
buffer_length = end;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue