/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6460501 6236036 6500694 6490770
* @summary Repeated failed timed waits shouldn't leak memory
* @author Martin Buchholz
*/
// Note: this file is now out of sync with the jsr166 CVS repository due to the fix for 7092140
public class TimedAcquireLeak {
}
}
final char[] buf = new char[1024];
int n;
}
}
try {
// Check for successful process completion
return output;
}
}
// To be called exactly twice by the parent process
p.getInputStream().read();
return result;
}
// To be called exactly twice by the child process
public static void rendezvousChild() {
try {
for (int i = 0; i < 100; i++) {
}
}
}
regex, 1));
if (i > 100)
"-dump:file=dump,format=b",
childPid));
return i;
}};
}
// jmap doesn't work on Windows
return;
};
// Check that no objects were leaked.
}
//----------------------------------------------------------------
// The main class of the child process.
// Job's job is to:
// - provide the name of a class to check for leaks.
// - call rendezvousChild exactly twice, while quiescent.
// - in between calls to rendezvousChild, run code that may leak.
//----------------------------------------------------------------
public static class Job {
return
"java.util.concurrent.locks.AbstractQueuedSynchronizer$Node";
}
final ReentrantReadWriteLock rwlock
= new ReentrantReadWriteLock();
//final int threads =
//rnd.nextInt(Runtime.getRuntime().availableProcessors() + 1) + 1;
final int threads = 3;
// On Linux, this test runs very slowly for some reason,
// so use a smaller number of iterations.
// Solaris can handle 1 << 18.
// On the other hand, jmap is much slower on Solaris...
for (int i = 0; i < threads; i++)
try {
for (int j = 0; j < iterations; j++) {
}
//int t = rnd.nextInt(2000);
}
} catch (Throwable t) { unexpected(t); }
}}.start();
rendezvousChild(); // Measure
rendezvousChild(); // Measure
}
// If something goes wrong, we might never see it, since IO
// streams are connected to the parent. So we need a special
// purpose print method to debug Jobs.
try {
}
}
//--------------------- Infrastructure ---------------------------
else fail(x + " not equal to " + y);}
}