ADF2010 LT AndroidéçºTipsã®ä¸èº«ï¼ä¿®æ£orz
Android Developers Forum 2010 in Osakaã«ã¦çºè¡¨ããå 容ãã¾ã¨ãã¾ããã
ä¸é¨GCã«ã¤ãã¦çºè¡¨æã®å
容ã«èª¤ããããã¾ããã
ãè©«ã³ãã¾ããä¿¡ãã人ããã¾ãããåã¤ãã¦ã¾ããorz
ã¾ã¨ãä¸ã§æ縮ã§ãããã¨ããããè¨æ£ã®ãããå
容ãéä¸ã¾ã§å
¬éãã¾ãï¼
ã¡ãªã¿ã«èª¤ã£ãé¨åã¯
ãã¼ã«ã«å¤æ°ãGCãèµ°ãããè¦å ã¨è¨ã£ã¦ãã¾ã£ã¦ãã¾ãã
æ£ããã¯ãªãã¸ã§ã¯ãçææã§ãã
- çãã¹ã³ã¼ãã®
å¤æ°ãªãã¸ã§ã¯ã
if(DEBUG)ã«ãããããã°
ãã使ããããã°ã»ããªã³ãã®Tipsã§ãã
- Logã¯ã©ã¹ãå©ç¨ãAndroid.utilãEclipceã§ã¯LogCatãã¥ã¼ã«è¡¨ç¤ºãããã
AndroidMarketã§å
¬éããã¦ããã¢ããªã±ã¼ã·ã§ã³ãUSBã±ã¼ãã«ã§ç¹ãã¨
ãã°ãåãæµãã®ã¾ã¾ã ã£ããã¨ãããã¾ãããããªç¶æ³ãé²ãã«ã¯
ä¸è¨ã®ããã«ããã¨å¹¸ãã«ãªããããã
>||java|
private static final boolean DEBUG = true;
if(DEBUG)Log.v("TAG","DEBUG NOW.");
|
GCãæèãã
Androidã¯Dalvikãã¼ãã£ã«ãã·ã³ä¸ã§åä½ãã¾ãã
ã¡ã¢ãªç®¡çã¯GCã«ä»»ããã¦ãããé常ã§ããã°
ã¢ããªã±ã¼ã·ã§ã³ããæèããå¿
è¦ã¯ããã¾ããã
ããããªããã¢ãã¤ã«ç«¯æ«ã¨ããããããªã»CPUãã¯ã¼ãå¶éããã
ç¶æ³ã§ã¯ãGCãèµ°ãã¨100msãæ°ç¾mså¿çãç¡ããªããã¨ãããã
å°ãªãããAppãããæèããªãã¨ãããªãã±ã¼ã¹ãããã¾ãã
- Cããå ¥ã£ã人ã¯ç¹ã«æ³¨æã
- çãã¹ã³ã¼ãã®
å¤æ°ãªãã¸ã§ã¯ã
GCã¸ã®å½±é¿ãå¤ãä¾
>||java|
for(i=0;i<10;i++){
Integer n = new Integer();
n = xxx;
data[i] = n;
}
|
GCã¸ã®å½±é¿ãå°ãªãä¾
>||java|
Integer n = new Integer();
for(i=0;i<10;i++){
n = xxx;
data[i] = n;
}
|