Search for the Memory Duplicities in the Java Applications Using Shallow and Deep Object Comparison
Richard Lipka, Tomas Potuzak
DOI: http://dx.doi.org/10.15439/2019F286
Citation: Proceedings of the 2019 Federated Conference on Computer Science and Information Systems, M. Ganzha, L. Maciaszek, M. Paprzycki (eds). ACSIS, Vol. 18, pages 781–789 (2019)
Abstract. In high-level object languages, such as Java, a problem of unnecessary duplicates of instances can easily appear. Although there can be a valid reason for maintaining several clones of the same data in the memory, often it indicates that the application can be refactored into a more efficient one. Unnecessary instances consume memory, but in case of Java applications can also have a significant impact on the application performance, as they might prolong the time needed for the garbage collection. In this paper, we are presenting a method and a tool that allows detecting duplicity in the heap dump of a Java application, based on the shallow and deep object comparison. The tool allows to identify the problematic instances in the memory and thus helps programmers to create a better application. On several case studies, we also demonstrate that the duplicates appear not only in the student projects and similar programs that often suffer from poor maintenance but also in commonly available Java tools and frameworks.
References
- N. Mitchell, E. Schonberg, and G. Sevitsky, “Four trends leading to java runtime bloat,” IEEE Software, vol. 27, no. 1, pp. 56–63, Jan 2010.
- K. Jezek and R. Lipka, “Antipatterns causing memory bloat: A case study,” in 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER), Feb 2017, pp. 306–315.
- P. Liden. (2017) String deduplication in g1 (acccessed: 13 may 2019). [Online]. Available: http://openjdk.java.net/jeps/192
- G. Xu and A. Rountev, “Precise memory leak detection for java software using container profiling,” in 2008 ACM/IEEE 30th International Conference on Software Engineering, May 2008, pp. 151–160.
- M. Jump and K. S. McKinley, “Cork: Dynamic memory leak detection for garbage-collected languages,” SIGPLAN Not., vol. 42, no. 1, pp. 31–38, Jan. 2007. [Online]. Available: http://doi.acm.org/10.1145/1190215.1190224
- T.-H. Chen, W. Shang, Z. M. Jiang, A. E. Hassan, M. Nasser, and P. Flora, “Detecting performance anti-patterns for applications developed using object-relational mapping,” in Proceedings of the 36th International Conference on Software Engineering, ser. ICSE 2014. New York, NY, USA: ACM, 2014, pp. 1001–1012. [Online]. Available: http://doi.acm.org/10.1145/2568225.2568259
- N. Mitchell and G. Sevitsky, “The causes of bloat, the limits of health,” SIGPLAN Not., vol. 42, no. 10, pp. 245–260, Oct. 2007. [Online]. Available: http://doi.acm.org/10.1145/1297105.1297046
- A. E. Chis, N. Mitchell, E. Schonberg, G. Sevitsky, P. O’Sullivan, T. Parsons, and J. Murphy, “Patterns of memory inefficiency,” in Proceedings of the 25th European Conference on Object-oriented Programming, ser. ECOOP’11. Berlin, Heidelberg: Springer-Verlag, 2011, pp. 383–407. [Online]. Available: http://dl.acm.org/citation.cfm?id=2032497.2032523
- G. Xu and A. Rountev, “Detecting inefficiently-used containers to avoid bloat,” SIGPLAN Not., vol. 45, no. 6, pp. 160–173, Jun. 2010. [Online]. Available: http://doi.acm.org/10.1145/1809028.1806616
- O. Shacham, M. Vechev, and E. Yahav, “Chameleon: Adaptive selection of collections,” SIGPLAN Not., vol. 44, no. 6, pp. 408–418, Jun. 2009. [Online]. Available: http://doi.acm.org/10.1145/1543135.1542522
- A. Infante and A. Bergel, “Object equivalence: Revisiting object equality profiling (an experience report),” SIGPLAN Not., vol. 52, no. 11, pp. 27–38, Oct. 2017. [Online]. Available: http://doi.acm.org/10.1145/3170472.3133844
- D. Marinov and R. O’Callahan, “Object equality profiling,” in Proceedings of the 18th Annual ACM SIGPLAN Conference on Object-oriented Programing, Systems, Languages, and Applications, ser. OOPSLA ’03. New York, NY, USA: ACM, 2003, pp. 313–325. [Online]. Available: http://doi.acm.org/10.1145/949305.949333
- K. Nasartschuk, M. Dombrowski, K. B. Kent, A. Micic, D. Henshall, and C. Gracie, “String deduplication during garbage collection in virtual machines,” in Proceedings of the 26th Annual International Conference on Computer Science and Software Engineering, ser. CASCON ’16. Riverton, NJ, USA: IBM Corp., 2016, pp. 250–256. [Online]. Available: http://dl.acm.org/citation.cfm?id=3049877.3049904
- K. Nasartschuk, K. B. Kent, S. A. MacKay, A. Micic, and C. Gracie, “Improving garbage collection-time string deduplication,” in Proceedings of the 27th Annual International Conference on Computer Science and Software Engineering, ser. CASCON ’17. Riverton, NJ, USA: IBM Corp., 2017, pp. 113–119. [Online]. Available: http://dl.acm.org/citation.cfm?id=3172795.3172809
- D. F. Bacon, S. J. Fink, and D. Grove, “Space- and time-efficient implementation of the java object model,” in Proceedings of the 16th European Conference on Object-Oriented Programming, ser. ECOOP ’02. Berlin, Heidelberg: Springer-Verlag, 2002, pp. 111–132. [Online]. Available: http://dl.acm.org/citation.cfm?id=646159.680023
- N. Grech, J. Rathke, and B. Fischer, “Jequalitygen: Generating equality and hashing methods,” Sigplan Notices - SIGPLAN, vol. 46, pp. 177–186, 10 2010.
- E. Aftandilian. (2018) Hprof heap dump parser (acccessed: 13 may 2019). [Online]. Available: https://github.com/eaftan/hprof-parser
- T. Potuzak and R. Lipka, “Deep object comparison for interface-based regression testing of software components,” in Proceedings of the 2018 Federated Conference on Computer Science and Information Systems, FedCSIS 2018, Poznań, Poland, September 9-12, 2018., 2018, pp. 1053–1062. [Online]. Available: https://doi.org/10.15439/2018F51
- Oracle. (2019) The jmap utility (acccessed: 13 may 2019). [Online]. Available: https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr014.html
- P. Software. (2019) Spring boot 2.1.4 (acccessed: 13 may 2019). [Online]. Available: https://spring.io/projects/spring-boot
- I. Eclipse Foundation. (2019) Eclipse ide 2018-12 (acccessed: 13 may 2019). [Online]. Available: https://www.eclipse.org/downloads/