Skip to content

Commit

Permalink
570485: CI Build failures due to OutOfMemoryError or SIGKILL
Browse files Browse the repository at this point in the history
Dispose of snapshots from collection tests when not
needed anymore.

Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=570485

Change-Id: I76f271352244efb9a44104e65d99eaf508c2d75e
  • Loading branch information
ajohnson1 committed Jan 19, 2021
1 parent c770d5c commit 216b0b3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ public static ISnapshot getSnapshot(String name, boolean pristine)
return getSnapshot(name, new HashMap<String, String>(), pristine);
}

/**
* This snapshot can be disposed as it won't be used again.
* The dump file itself is not deleted, but will be tidied up
* at the end.
* @param name
* @return true if successfully disposed.
*/
public static boolean freeSnapshot(String name)
{
ISnapshot answer = snapshots.get(name);
if (answer != null)
{
answer.dispose();
snapshots.remove(name);
return true;
}
else
{
return false;
}
}

/**
* Get a snapshot from a dump
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ public static Collection<Object[]> data3() throws SnapshotException, IOException
if (objects != null)
parms.add(objects);
}
Object[] objects = new Object[] { dmppath, dmpname, 7, null};
parms.add(objects);
// To ensure it isn't garbage collected early
System.out.println(cdp);
}
Expand Down Expand Up @@ -251,6 +253,13 @@ public void testCollections() throws SnapshotException
assumeThat(type, equalTo(6));
testCollections6(TestSnapshots.getSnapshot(snapfile,false), classname);
break;
case 7:
assumeThat(type, equalTo(7));
if (TestSnapshots.freeSnapshot(snapfile))
{
System.out.println("Unable to dispose of snapshot " + snapfile);
}
break;
}
}

Expand Down

0 comments on commit 216b0b3

Please sign in to comment.