diff --git a/dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java b/dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java index 2fc59c86d..02b1581f7 100644 --- a/dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java +++ b/dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java @@ -178,6 +178,7 @@ public void readResumeTest() throws Exception System.out.println("Messages from file part (" + i + ") read operation:\n" + fileReader.getRemoteReadMessages()); } + Runtime runtime = Runtime.getRuntime(); ArrayList resumedRecords = new ArrayList(); for (int i = 0; i < resumeInfo.size(); i++) { @@ -194,6 +195,13 @@ public void readResumeTest() throws Exception resumedRecords.add(record); } + + // Periodically run garbage collector to prevent buffers in remote file readers from exhausting free memory + // This is only needed due to rapidly creating / destroying thousands of HpccRemoteFileReaders + if ((i % 10) == 0) + { + runtime.gc(); + } } assertEquals("Number of records did not match during read resume.", records.size(), resumedRecords.size());