Skip to content

Commit

Permalink
More instrumentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnbroad committed Nov 19, 2024
1 parent 2493961 commit 3a31457
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/test/java/htsjdk/tribble/readers/ReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,27 @@ public void testLotsOfLines() throws IOException {

@Test
public void testMassiveLines() throws IOException {
System.gc(); // releive heap pressure before we strt this test so we don't run out of heap space
final StringBuilder b = new StringBuilder();
for ( int i = 0; i < 10; i++ ) {
for ( int j = 0; j < 1000000; j++) {
b.append(i + "." + j);
try {
final StringBuilder b = new StringBuilder();
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 1000000; j++) {
b.append(i + "." + j);
}
b.append("\n");
}
b.append("\n");
testStream(b.toString());
} catch (OutOfMemoryError e) {
System.out.println(String.format("Before Free: %d Max: %d Total: %d",
Runtime.getRuntime().freeMemory(),
Runtime.getRuntime().maxMemory(),
Runtime.getRuntime().totalMemory()));
System.gc(); // releive heap pressure before we strt this test so we don't run out of heap space
System.out.println(String.format("After Free: %d Max: %d Total: %d",
Runtime.getRuntime().freeMemory(),
Runtime.getRuntime().maxMemory(),
Runtime.getRuntime().totalMemory()));
Assert.fail("Ran out of memory");
}
testStream(b.toString());
}

@Test
Expand Down

0 comments on commit 3a31457

Please sign in to comment.