Upgrade to Pro — share decks privately, control downloads, hide ads and more …

メモリリークを気軽に確認するLeakCheckerの話

yagi
April 09, 2014

 メモリリークを気軽に確認するLeakCheckerの話

メモリリークのチェックって大変だなぁと思って

yagi

April 09, 2014
Tweet

More Decks by yagi

Other Decks in Technology

Transcript

  1. 4FUVQ apply plugin: 'android' ! repositories { mavenCentral() maven {

    url 'https://raw.github.com/sys1yagi/leak-checker/master/repository' } } dependencies { compile 'com.sys1yagi:leak-checker:0.0.1' } 3FGFSFODF3FQPTJUPSZ %FQFOEFODJFT
  2. .FNPSZ6TBHF @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MemoryUsage.startPrintMemoryUsage(); }

    ! @Override public void onDestroy() { super.onDestroy(); MemoryUsage.stopPrintMemoryUsage(); } TUBSUTUPQ
  3. $VTUPN-PHHFS public class TextViewMonitorLogger implements ILogger { private TextView target;

    ! public TextViewMonitorLogger(TextView target) { this.target = target; } ! @Override public void print(String tag, String message) { target.setText(message); } } LeakChecker.setLogger(logger); MemoryUsage.setLogger(logger); JNQMFNFOU*-PHHFS VTFDVTUPNMPHHFS
  4. ·ͱΊ w .FNPSZ6TBHF w ΞϓϦͷϝϞϦ࢖༻ঢ়گΛऔΕΔ w -FBL$IFDLFS w ΦϒδΣΫτΛ؂ࢹͰ͖Δ w

    EVNQͯ͠ϦʔΫͯ͠Δ͔νΣοΫʂʂ w *-PHHFS w *-PHHFSΛ࣮૷͢Ε͹Ͳ͜ʹͰ΋ग़ͤΔ