Same thing, there is no leak. You have no guarantee in your test that the GC was run. It is important for the system_server process to be GC'd as well, which your test does not guarantee.
On Tue, Jul 7, 2009 at 7:40 AM, Diego Torres Milano<[email protected]> wrote: > > This is fine. Thanks for the info. > However, I've been writing some tests using > ActivityInstrumentationTestCase2 and an Activity that depending on an > extra parameter displays the Toast or not, and the results seems to be > different. > If the Toast is displayed the instance count constantly increases but > if the Toast is not displayed it remains controlled. > Details and code can be found here: > http://dtmilano.blogspot.com/2009/07/android-testing-on-android-platform-is.html > Comments, suggestions and corrections are gladly welcome. > > > On Jul 7, 1:27 am, Romain Guy <[email protected]> wrote: >> There is no leak, I just verified myself. Your call to System.gc() >> does NOT guarantee that the GC will run. To check for leaks here is >> the procedure: >> >> - Run the app >> - Run adb shell dumpsys meminfo | grep -A 12 name.of.the.app.processs >> - Look at the count of Activities and ViewRoots >> - Run DDMS >> - Force a GC on the app's process >> - Force a GC on system_server >> - Force a GC on the app's process >> - Run adb shell dumpsys meminfo | grep -A 12 name.of.the.app.processs >> - Look at the count of Activities and ViewRoots >> (Repeat these steps) >> >> You will see that while the number of Activities/ViewRoot does >> increase temporarily, it always goes back down the normal numbers. >> >> >> >> On Mon, Jul 6, 2009 at 3:01 PM, skink<[email protected]> wrote: >> >> > On Jul 6, 6:33 pm, skink <[email protected]> wrote: >> >> however i read Toast's api docs again and found that ctor and/or >> >> makeText can use Activity context... so now i'm a bit lost here: is it >> >> a bug in Toast or docs shoukd be updated? >> >> >> thanks >> >> pskink >> >> > hi, >> >> > is it possible that nobody uses Toasts? >> >> > can i consider memory leaks when passing Activity ctx as a bug (and it >> > will be fixed in some future release) or i have to change ctx to app >> > context? >> >> > thanks >> > pskink >> >> -- >> Romain Guy >> Android framework engineer >> [email protected] >> >> Note: please don't send private questions to me, as I don't have time >> to provide private support. All such questions should be posted on >> public forums, where I and others can see and answer them > > > -- Romain Guy Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

