skip to main content
10.1145/2258996.2259010acmconferencesArticle/Chapter ViewAbstractPublication PagesismmConference Proceedingsconference-collections
research-article

new Scala() instance of Java: a comparison of the memory behaviour of Java and Scala programs

Published: 15 June 2012 Publication History

Abstract

While often designed with a single language in mind, managed runtimes like the Java virtual machine (JVM) have become the target of not one but many languages, all of which benefit from the runtime's services. One of these services is automatic memory management. In this paper, we compare and contrast the memory behaviour of programs written in Java and Scala, respectively, two languages which both target the same platform: the JVM. We both analyze core object demographics like object lifetimes as well as secondary properties of objects like their associated monitors and identity hash-codes. We find that objects in Scala programs have lower survival rates and higher rates of immutability, which is only partly explained by the memory behaviour of objects representing closures or boxed primitives. Other metrics vary more by benchmark than language.

References

[1]
O. Agesen, D. Detlefs, A. Garthwaite, R. Knippel, Y. Ramakrishna, and D. White. An efficient meta-lock for implementing ubiquitous synchronization. Technical report, Sun Microsystems, Inc., 1999.
[2]
D. Bacon, S. Fink, and D. Grove. Space- and time-efficient implementation of the Java object model. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP), 2006.
[3]
D. F. Bacon, R. Konuru, C. Murthy, and M. Serrano. Thin locks: featherweight synchronization for Java. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI), 1998.
[4]
VanDrunen, von Dincklage, and Wiedermann}Blackburn:2006:dacapoS. M. Blackburn, R. Garner, C. Hoffmann, A. M. Khang, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, B. Moss, A. Phansalkar, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java benchmarking development and analysis. In Proceedings of the 21st Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2006.
[5]
J. Bloch. Effective Java. Sun Microsystems, Inc., 2nd edition, 2008.
[6]
S. Dieckmann and U. Hölzle. A study of the allocation behavior of the SPECjvm98 Java benchmarks. In Proceedings of the European Conference on Object-Oriented Programming (ECCOP), 1999.
[7]
I. Dragos. Compiling Scala for performance. PhD thesis, École polytechnique fédérale de Lausanne, 2010.
[8]
B. Dufour, K. Driesen, L. Hendren, and C. Verbrugge. Dynamic metrics for Java. In Proceedings of the 18th Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2003.
[9]
B. Dufour, C. Goard, L. Hendren, O. de Moor, G. Sittampalam, and C. Verbrugge. Measuring the dynamic behaviour of AspectJ programs. In Proceedings of the 19th Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2004.
[10]
B. Dufour, B. G. Ryder, and G. Sevitsky. A scalable technique for characterizing the usage of temporaries in framework-intensive Java applications. In Proceedings of the 16th International Symposium on Foundations of Software Engineering (FSE), 2008.
[11]
B. Goetz, T. Peierls, J. Bloch, J. Bowbeer, D. Holmes, and D. Lea. Java Concurrency in Practice. Addison-Wesley Longman Publishing Co., Inc., 2006.
[12]
J. Gosling, B. Joy, G. Steele, and G. Bracha. Java Language Specification. Addison-Wesley Longman Publishing Co., Inc., 3rd edition, 2005.
[13]
C. Haack and E. Poll. Type-based object immutability with flexible initialization. In Proceedings of the European Conference on Object-Oriented Programming (ECCOP), 2009.
[14]
Hertz:2002:merlinM. Hertz, S. M. Blackburn, J. E. B. Moss, K. S. McKinley, and D. Stefanović. Generating object lifetime traces with Merlin. ACM Transactions on Programming Languages and Systems, 28 (3): 476--516, 2006.
[15]
I. Jibaja, S. Blackburn, M. Haghighat, and K. McKinley. Deferred gratification: Engineering for high performance garbage collection from the get go. In Proceedings of the Workshop on Memory Systems Performance and Correctness (MSPC), 2011.
[16]
R. E. Jones and C. Ryder. A study of Java object demographics. In Proceedings of the 7th International Symposium on Memory management (ISMM), 2008.
[17]
J.-S. Kim and Y. Hsu. Memory system behavior of Java programs: methodology and analysis. In Proceedings of the 2000 ACM SIGMETRICS Conference on Measurement and Modeling of Computer Systems (SIGMETRICS), 2000.
[18]
T. Lindholm and F. Yellin. Java Virtual Machine Specification. Addison-Wesley Longman Publishing Co., Inc., 2nd edition, 1999.
[19]
L. Marek, A. Villazón, Y. Zheng, D. Ansaloni, W. Binder, and Z. Qi. DiSL: a domain-specific language for bytecode instrumentation. In Proceedings of the 11th International Conference on Aspect-Oriented Software Development (AOSD), 2012.
[20]
M. Odersky, L. Spoon, and B. Venners. Programming in Scala. Artima Press, 2nd edition, 2010.
[21]
I. Pechtchanski and V. Sarkar. Immutability specification and its applications. In Proceedings of the 2002 joint ACM-ISCOPE Conference on Java Grande, 2002.
[22]
F. Pizlo, D. Frampton, and A. L. Hosking. Fine-grained adaptive biased locking. In Proceedings of the 9th International Conference on Principles and Practice of Programming in Java (PPPJ), 2011.
[23]
S. Porat, M. Biberstein, L. Koved, and B. Mendelson. Automatic detection of immutable fields in Java. In Proceedings of the 2000 Conference of the Centre for Advanced Studies on Collaborative Research (CASCON), 2000.
[24]
T. Printezis and R. Jones. GCspy: an adaptable heap visualisation framework. In Proceedings of the 17th Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2002.
[25]
N. P. Ricci, S. Z. Guyer, and J. E. B. Moss. Elephant Tracks: generating program traces with object death records. In Proceedings of the 9th International Conference on Principles and Practice of Programming in Java (PPPJ), 2011.
[26]
K. Russell and D. Detlefs. Eliminating synchronization-related atomic operations with biased locking and bulk rebiasing. In Proceedings of the 21st Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2006.
[27]
A. Sewe, M. Mezini, A. Sarimbekov, and W. Binder. Da Capo con Scala: Design and analysis of a Scala benchmark suite for the Java Virtual Machine. In Proceedings of the 26th Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2011.
[28]
A. Shankar, M. Arnold, and R. Bodik. Jolt: lightweight dynamic analysis and removal of object churn. In Proceedings of the 23rd Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPLSA), 2008.
[29]
X. Yang, S. M. Blackburn, D. Frampton, J. B. Sartor, and K. S. McKinley. Why nothing matters: the impact of zeroing. In Proceedings of the 26th Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2011.

Cited By

View all
  • (2024)Performance and Metrics Analysis Between Python3 via Mojo2024 2nd International Conference on Sustainable Computing and Smart Systems (ICSCSS)10.1109/ICSCSS60660.2024.10625342(1291-1297)Online publication date: 10-Jul-2024
  • (2019)Renaissance: benchmarking suite for parallel applications on the JVMProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314637(31-47)Online publication date: 8-Jun-2019
  • (2016)Workload characterization of JVM languagesSoftware—Practice & Experience10.1002/spe.233746:8(1053-1089)Online publication date: 1-Aug-2016
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ISMM '12: Proceedings of the 2012 international symposium on Memory Management
June 2012
152 pages
ISBN:9781450313506
DOI:10.1145/2258996
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 47, Issue 11
    ISMM '12
    November 2012
    136 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2426642
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 15 June 2012

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. java
  2. object demographics
  3. scala

Qualifiers

  • Research-article

Conference

ISMM '12
Sponsor:

Acceptance Rates

Overall Acceptance Rate 72 of 156 submissions, 46%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)13
  • Downloads (Last 6 weeks)1
Reflects downloads up to 27 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Performance and Metrics Analysis Between Python3 via Mojo2024 2nd International Conference on Sustainable Computing and Smart Systems (ICSCSS)10.1109/ICSCSS60660.2024.10625342(1291-1297)Online publication date: 10-Jul-2024
  • (2019)Renaissance: benchmarking suite for parallel applications on the JVMProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314637(31-47)Online publication date: 8-Jun-2019
  • (2016)Workload characterization of JVM languagesSoftware—Practice & Experience10.1002/spe.233746:8(1053-1089)Online publication date: 1-Aug-2016
  • (2015)Accurate profiling in the presence of dynamic compilationACM SIGPLAN Notices10.1145/2858965.281428150:10(433-450)Online publication date: 23-Oct-2015
  • (2015)Accurate profiling in the presence of dynamic compilationProceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications10.1145/2814270.2814281(433-450)Online publication date: 23-Oct-2015
  • (2015)Introduction to dynamic program analysis with DiSLScience of Computer Programming10.1016/j.scico.2014.01.00398:P1(100-115)Online publication date: 1-Feb-2015
  • (2014)Dynamic program analysis-Reconciling developer productivity and tool performanceScience of Computer Programming10.1016/j.scico.2014.03.01495:P3(344-358)Online publication date: 1-Dec-2014
  • (2013)ShadowVMACM SIGPLAN Notices10.1145/2637365.251721949:3(105-114)Online publication date: 27-Oct-2013
  • (2013)Model-driven generative framework for automated OMG DDS performance testing in the cloudACM SIGPLAN Notices10.1145/2637365.251721649:3(179-182)Online publication date: 27-Oct-2013
  • (2013)Does the discipline of preprocessor annotations matter?ACM SIGPLAN Notices10.1145/2637365.251721549:3(65-74)Online publication date: 27-Oct-2013
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media