Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/auto-jdk-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Auto JDK Matrix Test & Install

on:
push:
paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.xml', '**/*.yaml', '**/*.yml', '**/.*', '**/LICENSE', '**/NOTICE' ]
paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
pull_request:
paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.xml', '**/*.yaml', '**/*.yml', '**/.*', '**/LICENSE', '**/NOTICE' ]
paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
# The branches below must be a subset of the branches above
branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/auto-os-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Auto OS Matrix Test & Install

on:
push:
paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.xml', '**/*.yaml', '**/*.yml', '**/.*', '**/LICENSE', '**/NOTICE' ]
paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
pull_request:
paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.xml', '**/*.yaml', '**/*.yml', '**/.*', '**/LICENSE', '**/NOTICE' ]
paths-ignore: [ '**/*.html', '**/*.md', '**/*.txt', '**/*.yaml', '**/*.yml', '**/LICENSE', '**/NOTICE' ]
# The branches below must be a subset of the branches above
branches: [ 'main', '[0-9]+.[0-9]+.[Xx]' ]
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Note: *primitive* := *{byte, short, int, long, float, double}*
* *Memory.map(File, Arena)* (read only)
* *WritableMemory.writableMap(File)*

## Release 5.0.0 (inclusive) to 6.0.0 (exclusive)
## Release 5.0.0 (inclusive) to 7.0.0 (exclusive)
Starting with release *datasketches-memory-5.0.0*, this Memory component supports only Java 21 when compiling from source and may work with later Java versions at runtime.

### Runtime Notes:
Expand Down Expand Up @@ -106,7 +106,7 @@ To run javadoc:

mvn clean javadoc:javadoc -DskipTests=true

To run the eclipse plugin on this multi-module project, use:
To run the eclipse plugin on this project, use:

mvn clean eclipse:eclipse -DskipTests=true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,48 +43,52 @@ public class AllocateDirectMapMemoryTest {
@Test
public void simpleMap() throws IOException {
File file = UtilTest.setGettysburgAddressFileToReadOnly();
Memory mem = null;
try (Arena arena = Arena.ofConfined()) {
Memory mem = Memory.map(file, arena);
mem = Memory.map(file, arena);
arena.close();
} //The Try-With-Resources will throw since it is already closed
catch (IllegalStateException e) { /* OK */ }
if (mem != null) { assertFalse(mem.isAlive()); }
}

@Test
public void testIllegalArguments() throws IOException {
File file = getResourceFile("GettysburgAddress.txt");
Memory mem = null;
try (Arena arena = Arena.ofConfined()) {
Memory mem = Memory.map(file, -1, Integer.MAX_VALUE, ByteOrder.nativeOrder(), arena);
mem = Memory.map(file, -1, Integer.MAX_VALUE, ByteOrder.nativeOrder(), arena);
fail("Failed: test IllegalArgumentException: Position was negative.");
mem.getCapacity();
}
catch (IllegalArgumentException e) {
//ok
}
catch (IllegalArgumentException e) { /* OK */ }
if (mem != null) { assertFalse(mem.isAlive()); }
try (Arena arena = Arena.ofConfined()) {
Memory mem = Memory.map(file, 0, -1, ByteOrder.nativeOrder(), arena);
fail("Failed: testIllegalArgumentException: Size was negative.");
} catch (IllegalArgumentException e) {
//ok
mem = Memory.map(file, 0, -1, ByteOrder.nativeOrder(), arena);
fail("Failed: test IllegalArgumentException: Size was negative.");
}
catch (IllegalArgumentException e) { /* OK */ }
if (mem != null) { assertFalse(mem.isAlive()); }
}

@Test
public void testMapAndMultipleClose() throws IOException {
File file = getResourceFile("GettysburgAddress.txt");
long memCapacity = file.length();
Memory mem = null;
Memory mem2 = null;
try {
try (Arena arena = Arena.ofConfined()) {
Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder(), arena);
mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder(), arena);
mem2 = mem;
assertEquals(memCapacity, mem.getCapacity());
arena.close();
assertFalse(mem.isAlive());
} //a close inside the TWR block will throw here
}
catch (IllegalStateException e) { /* expected */ }
assertFalse(mem2.isAlive());
if (mem != null) { assertFalse(mem.isAlive()); }
if (mem2 != null) { assertFalse(mem2.isAlive()); }
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void simpleAllocateDirect() {
assertTrue(wMem.isAlive());
}
//The TWR block has exited, so the memory should be not alive
assertFalse(wMem2.isAlive());
if (wMem2 != null) { assertFalse(wMem2.isAlive()); }
}

@Test
Expand Down Expand Up @@ -96,6 +96,7 @@ public void checkExplicitCloseNoTWR() {
Arena arena = Arena.ofConfined();
WritableMemory wmem = WritableMemory.allocateDirect(cap, arena);
arena.close(); //explicit close
assertFalse(wmem.isAlive());
}

@Test
Expand Down