I ran this test on a machine with 224 logical CPUs and it fails with: ITERATION 3 test TestHandshake.testHandshake("SegmentMismatchAccessor", TestHandshake$$Lambda$57/0x00000001000e7968@37c4b344): failure java.lang.OutOfMemoryError: Cannot reserve 1000000 bytes of direct buffer memory (allocated: 536008192, limit: 536870912)
SegmentMismatchAccessor allocates a 1MB native segment for each CPU on each iteration. This can quickly reach the allocation limit if there is no intervening GC. Explicitly close the segment after each iteration to release the memory. ------------- Commit messages: - 8256435: [TESTBUG] java/foreign/TestHandshake.java fails with direct buffer memory OOM Changes: https://git.openjdk.java.net/jdk/pull/1254/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1254&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8256435 Stats: 9 lines in 1 file changed: 8 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/1254.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/1254/head:pull/1254 PR: https://git.openjdk.java.net/jdk/pull/1254