I am running robotium test suite for my android application using maven, but I am running into Java:out of memory exception, though when I am trying to run the test files individually they run fine. I tried analysing the heap dump using MAT and it says the culprit is an arraylist which is holding objects of all my test files which are in turn holding ojects of activities they are testing. The dump analysis is of 9.4MB and this araylist holds 4.3 MB of it. kindly suggest any solution.
Thanks in Advance!! Mayank
protected void tearDown() throws Exception {
//Log out...
solo.sendKey(Solo.MENU);
solo.clickOnText("More");
solo.clickOnText("Logout");
if (solo.searchButton("Logout")) {
solo.clickOnButton("Logout");
}
solo.waitForActivity(LoginActivity.class.getName(), 1000);
assertTrue(solo.searchText("Your id"));
int i = 0;
while(solo.getAllOpenedActivities()!=null && solo.getAllOpenedActivities().size()>0){
solo.finishOpenedActivities();
solo.goBack();
if(i++>5){
break;
}
}
solo.finishOpenedActivities();
solo = null;
System.gc();
}