access icon free Light-weight resource leak testing based on finalisers

Despite garbage collectors, programmers must manually manage many non-memory ‘finite system resources’ such as file descriptors and database connections. Unreleased resources result in ‘resource leaks’ that degrade application performance and can even result in system crashes. It is hard to test resource leaks because of their no immediate symptoms in the short run. There are analysis techniques to detect resource leaks statically or dynamically. However, all of them require the formal specification as input, which seriously decrease their practicability for common software developers. In this study, the authors propose an easy-to-use yet effective resource leak testing approach for Java programs based on existing finalisers of Java Application Programming Interface (API) classes. They instrument resource classes to check that the cleanup method of a resource object is called before its finaliser's execution. Otherwise, this resource object is leaked. To use this approach, programmers just add a few lines of code into their programs and no formal specifications are required. They carry out experiments on benchmarks in the literature to evaluate the incidence of object finalisation and performance cost of finalisers. Experimental results show that the authors' approach can test leaks of most system resources with high effectiveness and low overhead.

Inspec keywords: application program interfaces; Java; program testing

Other keywords: Java API classes; light-weight resource leak testing; resource classes; Java programs; object finalisation; resource object cleanup method; performance cost; application program interfaces; finalisers

Subjects: General utility programs; Diagnostic, testing, debugging and evaluating systems; Object-oriented programming

References

    1. 1)
      • 11. Allan, C., Avgustinov, P., Christensen, A.S., et al: ‘Adding trace matching with free variables to AspectJ’. Proc. 20th Annual ACM SIGPLAN Conf. on Object-Oriented Programming, Systems, Languages and Applications, 2005, pp. 345364.
    2. 2)
      • 1. Dybvig, R. K., Bruggeman, C., Eby, D.: ‘Guardians in a generation-based garbage collector’. Proc. ACM SIGPLAN 1993 Conf. on Programming Language Design and Implementation, 1993, pp. 207216.
    3. 3)
      • 20. http://www.dacapobench.org, accessed December 2012.
    4. 4)
      • 18. Weimer, W., Necula, G.C.: ‘Mining temporal specifications for error detection’. Tools and Algorithms for the Construction and Analysis of Systems, (LNCS, 3440), 2005, pp. 461476.
    5. 5)
      • 9. Arnold, M., Vechev, M., Yahav, E.: ‘QVM: an efficient runtime for detecting defects in deployed systems’, SIGPLAN Notice, 2008, 43, (10), pp. 143162 (doi: 10.1145/1449955.1449776).
    6. 6)
      • 17. Gosling, J., Joy, B., Steele, G., Bracha, G.: ‘Java language specification3rd edn, http://www.docs.oracle.com/javase/specs, accessed December 2012.
    7. 7)
      • 2. Weimer, W., Necula, G.C.: ‘Exceptional situations and program reliability’, ACM Trans. Program. Lang. Syst., 2008, 30, (2), pp. 151 (doi: 10.1145/1330017.1330019).
    8. 8)
      • 12. Blackburn, S.M., Garner, R., Hoffmann, C., et al: ‘The DaCapo benchmarks: ‘java benchmarking development and analysis’. Proc. 21st Annual ACM SIGPLAN Conf. on Object-Oriented Programming Systems, Languages and Applications, 2006, pp. 169190.
    9. 9)
      • 8. Pradel, M., Gross, T.R.: ‘Leveraging test generation and specification mining for automated bug detection without false positives’. Proc. 29th Int. Conf. on Software Engineering, 2012, pp. 288298.
    10. 10)
      • 19. Zhong, H., Zhang, L., Xie, T., Mei, H.: ‘Inferring resource specifications from natural language API documentation’. Proc. 2009 IEEE/ACM Int. Conf. on Automated Software Engineering, 2009, pp. 307318.
    11. 11)
      • 14. http://www.oracle.com/technetwork/java/archive-139210.html, accessed December 2012.
    12. 12)
      • 15. Boehm, H.-J.: ‘Destructors, finalizers, and synchronization’. Proc. 30th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, 2003, pp. 262272.
    13. 13)
      • 5. Bertolino, A.: ‘Software testing research: achievements, challenges, dreams’. Proc 2007 Future of Software Engineering, 2007, pp. 85103.
    14. 14)
      • 22. Aftandilian, E.E., Guyer, S.Z.: ‘GC assertions: using the garbage collector to check heap properties’. Proc. 2009 ACM SIGPLAN Conf. on Programming Language Design and Implementation, 2009, pp. 235244.
    15. 15)
      • 10. Chen, F., Rosu, G.: ‘Mop: ‘an efficient and generic runtime verification framework’. Proc. 22nd Annual ACM SIGPLAN Conf. on Object-Oriented Programming, Systems, Languages and Applications, 2007, pp. 569588.
    16. 16)
      • 26. Guyer, S.Z., McKinley, K.S., Frampton, D.: ‘Free-Me: a static analysis for automatic individual object reclamation’. Proc. 2006 ACM SIGPLAN Conf. on Programming Language Design and Implementation, 2006, pp. 364375.
    17. 17)
      • 25. https://www.sourceforge.net/projects/leaktesting/.
    18. 18)
      • 16. Bloch, J.: ‘Effective Java’ (Education Inc, 2008, 2nd edn.), pp. 2731.
    19. 19)
      • 23. http://www.javassist.org, accessed December 2012.
    20. 20)
      • 3. Martin, M., Livshits, B., Lam, M.S.: ‘Finding application errors and security flaws using PQL: a program query language’. Proc. 20th Annual ACM SIGPLAN Conf. on Object-Oriented Programming, Systems, Languages and Applications, 2005, pp. 365383.
    21. 21)
      • 13. http://www.download.eclipse.org/eclipse/downloads, accessed December 2012.
    22. 22)
      • 21. Bond, M.D., McKinley, K.S.: ‘Tolerating memory leaks’. Proc. 23rd ACM SIGPLAN Conf. Object-Oriented Programming, Systems, Languages and Applications, 2008, pp. 109126.
    23. 23)
      • 4. Torlak, E., Chandra, S.: ‘Effective interprocedural resource leak detection’. Proc. 32nd ACM/IEEE Int. Conf. on Software Engineering, 2010, vol. 1 pp. 535544.
    24. 24)
      • 7. Pacheco, C., Lahiri, S.K., Ernst, M.D., Thomas, B.: ‘Feedback-directed random test generation’. Proc. 29th Int. Conf. on Software Engineering, 2007, pp. 7584.
    25. 25)
      • 24. Gabel, M., Su, Z.: ‘Online inference and enforcement of temporal properties’. Proc. 32nd ACM/IEEE Int. Conf. on Software Engineering, 2010, vol. 1 pp. 1524.
    26. 26)
      • 6. Hastings, R., Joyce, B.: ‘Purify: fast detection of memory leaks and access errors’. Proc. Winter USENIX Conf., 1992, pp. 125136.
http://iet.metastore.ingenta.com/content/journals/10.1049/iet-sen.2013.0026
Loading

Related content

content/journals/10.1049/iet-sen.2013.0026
pub_keyword,iet_inspecKeyword,pub_concept
6
6
Loading