Вопрос

Our tester at work can't make our app get an OOM error by testing by hand, but when we run our integration tests, after about 50 or so tests we get an OOM error and the rest of the tests don't finish.

I'd like to dump the heap when we get OOM during the integration tests. I'm using Maven, and Spoon to kick off the integration tests. I'd really like to take a look at the heap to see what's killing memory. I tried connecting monitor during the test run, but the port ddms tries to hook into is tied up.

Это было полезно?

Решение

The test infrastructure could have been hooked into the ddms port.

You could actually dump the heap from your test by calling android.os.Debug.dumpHprofData(). The test should run in the same process space as your app. Hence, it should work fine. Start taking the heap dumps in each test after the 45th test and you could probably get the heap dump that you need to analyze.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top