0

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();
}
Mayank
  • 15
  • 2
  • 5

1 Answers1

0

The issue you are describing is fixed in Robotium version 3.4.1. Please use that version instead.

Renas
  • 1,919
  • 1
  • 18
  • 17
  • Hi Renas. I tried it with the new vwesion also but I a still facing the same problem. – Mayank Aug 14 '12 at 07:46
  • this is my tear down looks like. I was going through the issue 249 at the robotium site and it looks like the same issue which I am facing. – Mayank Aug 14 '12 at 10:37
  • The issue is that you use solo.getOpenedActivities() in your tearDown() and by doing that you create hard references to the activities. That is why you are getting the memory error. – Renas Aug 14 '12 at 17:51