I will try these tools. Thanks, both of you. --- 10年5月20日,周四, Mathias Lin <[email protected]> 写道:
发件人: Mathias Lin <[email protected]> 主题: [android-developers] Re: How to find memory leak? 收件人: "Android Developers" <[email protected]> 日期: 2010年5月20日,周四,下午8:19 Yourkit, http://yourkit.com/overview/index.jsp, is another profiler tool that could be used. In sdk2.1, you can also do it on a non-rooted device - you can create a hprov from within the app and write it to sdcard. Debug.dumpHprofData("/sdcard/myapp.hprov"); At least in v2.1, possible that this wasn't availabe in 1.x sdk. On May 20, 8:10 pm, pacoder <[email protected]> wrote: > I've been using Eclipse MAT (http://www.eclipse.org/mat/) to look at > heap dumps. My phone isn't rooted so I run my app in the emulator then > use adb to do a kill -10 which forces a heap dump. I then do an adb > pull to grab the file (your logcat will give you the name of the heap > dump output file when it runs). Then I use the android hprof-conv tool > to convert the heap dump to one that MAT can read. Then just open it > up in MAT and you can look around through the dump. It will also > suggest leak candidates to you, it's a nice tool. Also, you will need > to grant write permissions to the output directory in your emulator. I > just go do a chmod 777 /user/data. > > hth, > > Sean Overby > > On May 20, 6:27 am, Jiang <[email protected]> wrote: > > > > > When start Activity A, I found the memory usage of application is about 5MB, > > > Then start Activity B from A via startActivity. In Activity B, I created a > > thread, and traverse file system in this > > thread, after traversing completed, call finish() and to return to Activity > > A. at this time, I found the memory usage of application is about 8MB (GC > > is forced before check memory usage). > > > How to find Where memory leaks? > > > By the way, I checked the memory usage with DDMS. > > > Thanks. > > > -- > > 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 > > athttp://groups.google.com/group/android-developers?hl=en > > -- > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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 -- 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

