Heap profiling for space-efficient Java

R. Shaham*, E. K. Kolodner, M. Sagiv

*Corresponding author for this work

Research output: Contribution to conferencePaperpeer-review


We present a heap-profiling tool for exploring the potential for space savings in Java programs. The output of the tool is used to direct rewriting of application source code in a way that allows more timely garbage collection (GC) of objects, thus saving space. The rewriting can also avoid allocating some objects that are never used. The tool measures the difference between the actual collection time and the potential earliest collection time of objects for a Java application. This time difference indicates potential savings. Then the tool sorts the allocation sites in the application source code according to the accumulated potential space saving for the objects allocated at the sites. A programmer can investigate the source code surrounding the sites with the highest savings to find opportunities for code rewriting that could save space. Our experience shows that in many cases simple code rewriting leads to actual space savings and in some cases also to improvements in program runtime. Experimental re sults using the tool and manually rewriting code show average space savings of 18% for the SPECjvm98 benchmark suite. Results for other benchmarks are also promising. We have also classified the program transformations that we have used and argue that in many cases improvements can be achieved by an optimizing compiler.

Original languageEnglish
Number of pages10
StatePublished - 2001
EventACM SIGPLAN'01 Conference on Programming Language Design and Implementation (PLDI) - Snowbird, UT, United States
Duration: 20 Jun 200122 Jun 2001


ConferenceACM SIGPLAN'01 Conference on Programming Language Design and Implementation (PLDI)
Country/TerritoryUnited States
CitySnowbird, UT


  • Compilers
  • Garbage collection
  • Java
  • Memory management
  • Profiling
  • Program analysis

Cite this