X Tutup
Skip to content

Commit 268b95d

Browse files
committed
JavaCL: small sweat test to check no obvious gc / pointer-related crash occurs.
1 parent a9dae49 commit 268b95d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.nativelibs4java.opencl;
2+
3+
import org.junit.Test;
4+
5+
public class SweatTest {
6+
static {
7+
System.setProperty("bridj.debug.pointer.releases", "true");
8+
}
9+
@Test
10+
public void sweatTest() {
11+
long tot = 0;
12+
for (boolean cached : new boolean[] { false, true }) {
13+
for (int time = 0; time < 100; time++) {
14+
CLContext context = JavaCL.createBestContext(CLPlatform.DeviceFeature.GPU);
15+
CLQueue queue = context.createDefaultQueue();
16+
CLProgram program = context.createProgram("kernel void f(global int* a) { a[0] = 1; }");
17+
program.setCached(cached);
18+
program.build();
19+
CLKernel kernel = program.createKernel("f");
20+
kernel.release();
21+
program.release();
22+
queue.release();
23+
context.release();
24+
System.gc();
25+
}
26+
}
27+
System.out.println(tot);
28+
}
29+
}

0 commit comments

Comments
 (0)
X Tutup