Skip to content

Commit 26a1ec1

Browse files
committedNov 18, 2020
8256435: [TESTBUG] java/foreign/TestHandshake.java fails with direct buffer memory OOM
Reviewed-by: mcimadamore
1 parent ef3ddb1 commit 26a1ec1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed
 

‎test/jdk/java/foreign/TestHandshake.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,13 @@ public final void run() {
103103
}
104104
long delay = System.currentTimeMillis() - start.get();
105105
System.out.println("Accessor #" + id + " terminated - delay (ms): " + delay);
106+
cleanup();
106107
}
107108

108109
abstract void doAccess();
109110

111+
void cleanup() {}
112+
110113
private void backoff() {
111114
try {
112115
Thread.sleep(ThreadLocalRandom.current().nextInt(MAX_THREAD_SPIN_WAIT_MILLIS));
@@ -185,6 +188,11 @@ static class SegmentMismatchAccessor extends AbstractSegmentAccessor {
185188
public void doAccess() {
186189
segment.mismatch(copy);
187190
}
191+
192+
@Override
193+
void cleanup() {
194+
copy.close();
195+
}
188196
}
189197

190198
static class BufferAccessor extends AbstractBufferAccessor {
@@ -251,7 +259,7 @@ static Object[][] accessors() {
251259
return new Object[][] {
252260
{ "SegmentAccessor", (AccessorFactory)SegmentAccessor::new },
253261
{ "SegmentCopyAccessor", (AccessorFactory)SegmentCopyAccessor::new },
254-
{ "SegmentMismatchAccesor", (AccessorFactory)SegmentMismatchAccessor::new },
262+
{ "SegmentMismatchAccessor", (AccessorFactory)SegmentMismatchAccessor::new },
255263
{ "SegmentFillAccessor", (AccessorFactory)SegmentFillAccessor::new },
256264
{ "BufferAccessor", (AccessorFactory)BufferAccessor::new },
257265
{ "BufferHandleAccessor", (AccessorFactory)BufferHandleAccessor::new }

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Nov 18, 2020

@openjdk-notifier[bot]
Please sign in to comment.