memory leak when closing and restarting appliction several times

by Julie Alexan » Tue, 21 Apr 2009 23:09:59 GMT


Sponsored Links
 Hi, All!  Using 'ddms' and repeatably clicking SysInfo -> Update from
Device helped me find a memory leak.  So we have 9 JUnit test cases
spread amongst 4 files, and we run them in eclipse.  After EACH test
cases finishes, our application is exiting; and it restarts again for
the next test case.  So for now, that's 9 times our app is closing and
restarting, which would be fine, except that each time it close it
leaks memory so that there is less available for the next test.  All
we have for @before and @after is this:

        @Before
        public void setUp() {
                System.gc();   // <-------- TRIED TO SEE IF THIS WOULD HELP, 
BUT IT
DIDN'T
        startActivity("com.yellowpages.android.ypmobile",
"com.yellowpages.android.ypmobile.YPM");
        waitForStartup();
        }

        @After
        public void postTest() {
                if (wait_post_test) {
                waitFor("class.simpleName", "BASIC_TIMEOUT", timeout_in_ms);
                }
        }

Questions:
1.  What's the proper solution?  Find a way to only start the app ONE
time then run all tests?  Or fix the leak?
2.  To fix the leak, is there something we're missing/forgetting to do
in the @After method?
3.  As a quick fix, is there somewhere particular in the positron code
that I can do a garbage collect() that might help?

Any help is appreciated.
Thanks,

Julie


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. erase char in adb shell?

Anyone know if there's a built-in way to change erase char when using
adb shell?  adb doesn't forward my terminal settings, stty isn't
installed, and unfortunately on my desktop backspace sends ^H, whereas
android has erase set to ^? (DEL).

No, I'm not going to change the erase character on my desktop just to
get adb shell to work.

It looks like I could cross-compile and install stty myself, but I
don't feel like doing that.

On a related note, is there a way to set up something like a /etc/
profile for the shell?

Note: I'm using a G1, CRC1 release.

Thanks.

--~--~---------~--~----~------------~-------~--~----~

2. Set up Simple

Simple is new basic like android programming language.
I red instructions on Simple google code page, but they are not step
by step
Does someone know how to set up Simple build environment?
I'm on linux

--~--~---------~--~----~------------~-------~--~----~

3. Beginner problem with TabHost

4. touch back buttun

5. App shutdown during package reinstall

6. Web-Browser in Emulator

7. Showing places near current location