内存泄露

来源:互联网 发布:淘宝店铺招牌设计制作 编辑:程序博客网 时间:2024/04/24 02:46

http://biowallet.blogspot.com/2009/04/analyze-android-memory-dump-with.html

 http://yueguc.javaeye.com/blog/788811

 

1.下载MAT

2。反复操作case(可参考下面)

3.

kill -10 <pid number>



4.



hprof-conv android-dump.hprof standard-dump.hprof



5.MAT 打开。



http://www.ophonesdn.com/article/show/277









Part 1: Tool Installation







1> Go to my shared folder //w4972c-02/beihai_ata_mrc_only


, copy all items into your local PC, suggest to save them in C:/.



















2> Connect you test phone with PC via usb cable, select debugging mode.







3> Had better ensure adb command can be send to test phone correctly, then







4> Dubole click "1_Install_tools_oms_product_.
bat" to install ATA & MrC tools into test phone in "/data" directory.

5> Dubole click "3_1_Setup_ATA_Snappertd_32I.bat" to setup ATA tool.

6> Power cycle the test phone.

After execute above steps, the 2 tools will be installed correctly.

Part2: MrC usage.

a) Start MrC
1> adb shell
2> #cd data
3> #./android_mrc &     (note: there is a blank before &)

    Then you can do your case, after done the case, then

b) Get MrC log
1> adb pull /data/_mrc_auto/memruntimeinfo.csv c:/ (or your specific folder)

    If want to generate a chart for the memorized process, pls refer to attached guide for MrC.

Part3: ATA usege

a) Start ATA tool
1>adb shell
2>#cd data
3>#ataagent (note: this step is to start ATA tool, if see below info that is to say ATA has been started successfully)
----atahandle::currentpara=372
Result: Parcel(00000000 00000001   '........')
There has Logcial Capture!
ATA agent has started!
   Otherwise, pls do "ps" command to find all processes' PID, if you canfind the process "/data/ataagent" or "ataagent", that is to say the ATAtool has been started already. If you can not find, wait for a while,then re-start ATA tool again.

b) Record script & stop
1>#ataagent record/data/MusicPlaying.txt (note: "/data/c9/MusicPlaying.txt" is thescript's directory and name, you can specify the location you like)
2>#ataagent stop

c) Run script & stop
1>#ataagent playback /data/MusicPlaying.txt
2>#ataagent stopplay

d) Run a list & stop
If you want to run a script many time, pls add the script a the list file, a list file is like below:

#start
/data/1.txt,100
#end


Only replacing the script (red part) by the script you want to run and specifying the loop time you like (at blue part) is ok.

then push the list.lst file into "/data" folder, and run it like below:
1>#ataagent playback /data/list.lst
2)#ataagent stopplay (note: stop the list)