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. Access sim card via code in Android

Hi All

I am quite new to Android.
I develope telephony tests that checks SIM functionality
Can somebody provide code examples of how we can access sim card via
code
What Android APIs can I use to read contacks to write sim etc.
I have an access to internal apis (that are not a part of Android)


Thanks

-- 

2. Querying the standard browser

Is it possible to interface with the standard browser?

I would like to know what urls are open in all browser windows/tabs,
maybe the history for each window/tab and finally the position(what
text is visible, scrollbar percent etc.) of each window.

Is this possible?

I've looked at the tutorials for webview, but it only seems to be able
to display a new url. If I could iterate all open windows/tabs as
webviews I think I could get the information out that I'm looking for.

/Ole

-- 

3. Subscription

4. howto update all after language change programmatically

5. OnLongClick not available for GridView?

6. Showing image from Url

7. Signing in to Google for Google Document access