Search This Blog 找資訊



2010年3月17日 星期三

how to trace memory leak in Android ?

this post is really a question, doesn't contain the answer Orz

this big question may consist of several items

what is memory leak ? 

how  to monitor Android system memory and performance ?

linux command :

ps -x
cat /proc/meminfo

not know exactly : 

dumpsys meminfo proc-id
time command-line

and DDMS (Android SDK tool) !!

Could automatic track memory leak on Android ?

DDMS could help !

but need to do some settings ( group discuss Finding Memory leak in native code )

0. Build 

1. replace system/lib/ with /system/lib/ 

2. set environment variables 

 $PATH with ~/open_src/prebuilt/linux-x86/toolchain/arm-eabi-XXX/bin
 $ANDROID_PRODUCT_OUT with ~/open_src/out/target/product/

'PATH' is used for getting "arm-eabi-addr2line" and
ANDROID_PRODUCT_OUT for getting the path to /symbol folder. 

3. restart the framework.  

adb shell stop && adb shell start 

4. Add "native=true" to  ~/.android/ddms.cfg

5. start the stand-alone version of DDMS.  -> "Native Heap" 

but just know that there  was an malloc @@ !!

how to avoid memory leak in application ?

from Avoid memory leaks on Android suggestion:

  • Do not keep long-lived references to a context-activity (a reference to an activity should have the same life cycle as the activity itself)
  • Try using the context-application instead of a context-activity
  • Avoid non-static inner classes in an activity if you don’t control their life cycle, use a static inner class and make a weak reference to the activity inside

to be continued ...

What is memory leak ?

What is memory leak ?

wiki said:

memory leak or leakage in computer science is a particular type of memory consumption by a computer program where the program is unable to release memory it has acquired.

more detail in :

an easy understand example about memory leak, please refer to this link:

女工程師的美加生活手札- Memory Leak 

other related webpage :

Handling memory leaks in Java programs

Memory Leak Detection in C++

2010年3月10日 星期三



2010年3月6日 星期六

HTML5 rocks !

Google說 The browser is the computer

這個願景,需要HTML5 !

先提一下,什麼是HTML5 ?



1. 資訊日新月異,沒事多上網,多上網沒事
2. 被Issue搞得 一看到Canvas先想到Street View @@

Android與語音辨識 Speech Input API for Android

從Android官方Blog推出一篇新文章 Speech Input API for Android
Nuance跟賽微要小心啦 ~

好急好急,你 ~ 累了嗎?

我感覺寫什麼A.S.A.P 太不親切了~

阿 ~ 阿就 好急好急阿 @@


突然有些感想,想要對SPM說 :

一天到晚好急好急,真的不累嗎 @@


共勉之 ~

Welcome to Taiwan ! 推薦台灣住宿