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:

        public void setUp() {
                System.gc();   // <-------- TRIED TO SEE IF THIS WOULD HELP, 

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

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.



Other Threads

1. g1phone

why cant i put my music and pics on the new g1 phone it wont let me do
anything are there drivers yhat i need to down load?


2. Keeping a service alive?

I have created a service that runs a Timer and TimerTask.  That timer
may fire every 5 minutes to 4 hours, depending on the user's
settings.  My problem is that my service eventually gets destroyed.
Is there a setting to keep it alive, or someway to tell the OS to
restart it once enough resources are available?

In addition, I'm not sure my implementation is the most sound.  What's
the best way run a TimerTask as a background process?


3. New site offering free android apps

4. problem downloading source

5. Is BrowserCallback missing in my SDK or does it not exist?

6. mime handler with inline content disposition

7. how to read the trace file