8282314: nsk/jvmti/SuspendThread/suspendthrd003 may leak memory

Reviewed-by: dholmes, cjplummer, amenkov, lmesnik, mseledtsov
This commit is contained in:
Daniel D. Daugherty 2022-03-10 19:13:55 +00:00
parent f5217b475e
commit bb7ee5a04a
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, 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
@ -88,6 +88,9 @@ public class suspendthrd003 extends DebugeeClass {
int res = -1;
long start_time = System.currentTimeMillis();
while (System.currentTimeMillis() < start_time + (timeMax * 1000)) {
// Start each loop with a clear log buffer so we only
// track the run that can potentially fail:
log.clearLogBuffer();
count++;
// Original suspendthrd001 test block starts here:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2022, 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
@ -477,6 +477,13 @@ public class Log extends FinalizableObject {
/////////////////////////////////////////////////////////////////
/**
* Clear all messages from log buffer.
*/
public synchronized void clearLogBuffer() {
logBuffer.clear();
}
/**
* Print all messages from log buffer which were hidden because
* of non-verbose mode,