Systematic Testing for Resource Leaks in Android Applications

985 views

Published on

The use of mobile devices and the complexity of their software continue to grow rapidly. This growth presents significant challenges for software correctness and performance. In addition to traditional defects, a key consideration are defects related to the limited resources available on these devices. Resource leaks in an application, due to improper management of resources, can lead to slowdowns, crashes, and negative user experience. Despite a large body of existing work on leak detection, testing for resource leaks remains a challenging problem. We propose a novel and comprehensive approach for systematic testing for resource leaks in Android software. Similar to existing testing techniques, the approach is based on a GUI model, but is focused specifically on coverage criteria aimed at resource leak defects. These criteria are based on neutral cycles: sequences of GUI events that should have a "neutral" effect and should not lead to increases in resource usage.

We have defined several test coverage criteria based on different categories of neutral cycles in the GUI model. This approach is informed by knowledge of typical causes of resource leaks in Android software. We have also developed LeakDroid, a tool that generates test cases to trigger repeated execution of neutral cycles. When the test cases are executed, resource usage is monitored for suspicious behaviors. The approach has been evaluated on several Android applications. The evaluation demonstrates that the proposed test generation effectively uncovers a variety of resource leaks.

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

Systematic Testing for Resource Leaks in Android Applications

  1. 1. Systema(c*Tes(ng*for*Resource*Leaks*in*Android* Applica(ons* Dacong (Tony) Yan, Shengqian Yang, Atanas Rountev Ohio State University PRESTO:(Program(Analyses(and(So5ware(Tools(Research(Group,(Ohio(State(University(
  2. 2. Background( •  Android(devices( •  Currently(lead(the(smartphone(market( •  Direct(impact(on(millions(of(users( •  Require(novel(techniques(for(improved(so5ware(quality( •  Resource(leaks( •  Examples(of(resources:(memory((managed(or(naIve),( database(cursors,(binders,(bitmaps,(etc.( •  Slowdowns(and(crashes( •  Limited(resources(on(handheld(devices( **
  3. 3. An(Example:(APV( Open PDF Close PDF **
  4. 4. NaIve(Memory(ConsumpIon(Comparison( **
  5. 5. Our(Proposal( •  Challenges:(developing(leakQtriggering(test(cases( and(test(inputs( •  Insight( •  Leaks(triggered(by(repeated(operaIons( •  Focus(on(neutral(cycles,(repeated(operaIons(that( should(not(increase(resource(usage( •  ModelQbased(test(generaIon( •  Input:(a(model(for(applicaIon(GUI,(called(GUI(model( •  Generate(test(cases(to(cover(neutral(cycles(in(the(GUI( model(for(leak(discovery( **
  6. 6. GUI(Model( •  DefiniIon( •  A(directed(graph(G=(N,(E)( •  N:(GUI(states,(i.e.(GUI(enIIes(and(their(relaIonships( •  E:(transiIons(between(states(triggered(by(events( **
  7. 7. GUI(Model(for(APV(
  8. 8. GUI(Model(for(APV(
  9. 9. GUI(Model(for(APV(
  10. 10. GUI(Model( •  DefiniIon( •  A(directed(graph(G=(N,(E)( •  N:(GUI(states,(i.e.(GUI(enIIes(and(their(relaIonships( •  E:(transiIons(between(states(triggered(by(events( •  Two(categories(of(transiIons( •  ApplicaIonQindependent( •  ApplicaIonQdependent( **
  11. 11. GUI(Model(for(APV( Applica5on(Independent(Transi5ons(
  12. 12. GUI(Model(for(APV( Applica5on(Dependent(Transi5ons(
  13. 13. Coverage(Criteria( • ApplicaIonQindependent(cycles( • Events(defined(by(the(plaVorm,(and(not(specific(to( individual(applicaIons( • Example:(ROTATE,(HOME,(POWER( • Cycles(with(BACK(transiIons( • BACK(transiIon:(going(back(to(a(previous(acIvity( • Opportunity(for(forming(a(cycle( • ApplicaIonQspecific(neutral(operaIons( • Pairs(of(operaIons(that(“neutralize”(each(other( • Example:(zoomQin(followed(by(zoomQout(
  14. 14. Example(of(a(Generated(Test(Case(
  15. 15. Example(of(a(Generated(Test(Case( n1 n3)k (n2 BACK
  16. 16. GUI(Model(for(APV(
  17. 17. GUI(Model(for(APV(
  18. 18. Example(of(a(Generated(Test(Case(
  19. 19. Example(of(a(Generated(Test(Case(
  20. 20. Example(of(a(Generated(Test(Case(
  21. 21. Example(of(a(Generated(Test(Case(
  22. 22. Example(of(a(Generated(Test(Case(
  23. 23. Approach( ●  Generate(automaIcally(test(cases(based(on(the( GUI(model,(and(the(targeted(coverage(criteria( ●  ●  Collect(resource(usage(measurements(as(the(tests( are(being(executed( ●  ●  ●  ** Followed(by(manual(steps,(e.g.,(to(provide(a(PDF(file(to( be(opened,(and(to(place(it(at(posiIon(3(of(the(file(list( Examples:(managed(heap(size,(naIve(heap(size,( binders,(threads( Drop(“nonQpromising”(cases(for(shorter(execuIon(Ime( Report(crashing(execuIons(for(possible(resource( leaks(
  24. 24. Experimental(Studies( ●  ●  8(openQsource(Android(applicaIons( The(generated(test(cases(exposed(18(resource(leak( defects((12(newlyQdiscovered)( ●  ●  Detailed(case(studies(to(understand(diversified( causes(of(resource(leaks( ●  ●  ●  ** InvesIgated(manually(the(crashing(test(cases(to( determine(their(root(causes( TradiIonal(leaks((e.g.,(container(leak)( Leaking(AndroidQspecific(objects((e.g.,(database(cursors,( binders,(bitmaps)( Leaks(caused(by(naIve(code((e.g.,(improper( management(of(naIve(memory,(hang(in(naIve(code)(
  25. 25. Conclusions( ●  ●  ●  Resource(leaks(are(an(important(problem(for( Android( ModelQbased(test(generaIon(focusing(on(neutral( cycles(is(effecIve(in(detecIng(resource(leaks( Future(work( ●  ●  ●  ** ●  Automated(debugging(of(uncovered(leaks,(using(heap( analysis( Automated(GUI(model(construcIon((iniIal(work(to( appear(at(CGO(2014)( Program(analysis(to(detect(and(diagnose(leaks(staIcally( So5ware(release( ●  hfp://www.cse.ohioQstate.edu/presto/so5ware/(
  26. 26. ( ( Thank((you( ((((((((((((((((( **

×