Region-Based Memory Management: An Evaluation of Its Support in RTSJ

  • M. Teresa Higuera-Toledano
  • Sergio Yovine
  • Diego Garbervetsky


Memory management is a source of unpredictability in the execution time of Java programs. This is because garbage collection introduces possibly unbounded blocking pauses to threads, which is unacceptable in real-time systems. To cope with this problem, the Real-Time Specification for Java (RTSJ) adopts a region-based approach which relies on memory scopes that are automatically freed upon termination of their lifetime. This allows the turning off of garbage collection during the execution of critical tasks, thus ensuring real-time guarantees. This chapter explains the RTSJ memory model and proposes improvements to its suggested implementation. It also discusses a static analysis-based approach to ensure that memory scopes are correctly use and dimensioned at compile time.


Garbage Collection Memory Management Critical Task Assignment Rule Memory Area 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.



This research was supported by the Research Program S2009/TIC-1468, and by Ministerio de Educación y Ciencia, through the research grant TIN2009-.07146.


  1. 25.
    H.G. Baker. The treadmill: real-time garbage collection without motion sickness. SIGPLAN Not., 27(3):66–70, 1992.CrossRefGoogle Scholar
  2. 37.
    P. Basanta-Val, M. Garcia-Valls, and I. Estevez-Ayres. Agcmemory: A new real-time Java region type for automatic floating garbage recycling. ACM SIGBED, 2(3), July 2005.Google Scholar
  3. 38.
    P. Basanta-Val, M. Garcia-Valls, and I. Estevez-Ayres. Enhancing the region model of real-time Java for large-scale systems. In 2nd Workshop on High Performance, Fault Adaptative, Large Scale Embedded Real-Time Systems, May 2005.Google Scholar
  4. 40.
    P. Basanta-Val, M. Garcia-Valls, and I. Estevez-Ayres. Extendedportal: violating the assignment rule and enforcing the single parent one. In 4th International Workshop on Java Technologies for Real-Time and Embedded Systems, page 37, October 2006.Google Scholar
  5. 53.
    W. S. Beebee and M. C. Rinard. An implementation of scoped memory for real-time Java. In EMSOFT, pages 289–305, 2001.Google Scholar
  6. 54.
    E. Benowitz and A. Niessner. A patterns catalog for RTSJ software designs. In Workshop on Java Technologies for Real-Time and Embedded Systems (JTRES), Lecture Notes in Computer Science, volume 2889, pages 497–507, 2003.Google Scholar
  7. 58.
    B. Blanchet. Escape analysis for JavaTM: Theory and practice. ACM Trans. Program. Lang. Syst., 25(6):713–775, November 2003.MathSciNetCrossRefGoogle Scholar
  8. 63.
    G. Bollella, T. Canham, V. Carson, V. Champlin, D. Dvorak, B. Giovannoni, M. Indictor, K. Meyer, A. Murray, and K. Reinholtz. Programming with non-heap memory in the real time specification for Java. In OOPSLA Companion, pages 361–369, 2003.Google Scholar
  9. 65.
    G. Bollella, J. Gosling, B. Brosgol, P. Dibble, S. Furr, and M. Turnbull. The Real-Time Specification for Java. Java Series. Addison-Wesley, June 2000.Google Scholar
  10. 67.
    G. Bollella and K. Reinholtz. Scoped memory. In Symposium on Object-Oriented Real-Time Distributed Computing, pages 23–25, 2002.Google Scholar
  11. 71.
    A. Borg and A. J. Wellings. Reference objects for RTSJ memory areas. In OTM Workshops, pages 397–410, 2003.Google Scholar
  12. 76.
    V. A. Braberman, F. Fernández, D. Garbervetsky, and S. Yovine. Parametric prediction of heap memory requirements. In ISMM’08: Proceedings of the 7th international symposium on Memory management, pages 141–150, New York, 2008. ACM.Google Scholar
  13. 77.
    V. A. Braberman, D. Garbervetsky, and S. Yovine. A static analysis for synthesizing parametric specifications of dynamic memory consumption. Journal of Object Technology, 5(5):31–58, 2006.CrossRefGoogle Scholar
  14. 101.
    S. Cherem and R. Rugina. Region analysis and transformation for Java programs. In ISMM, pages 85–96, 2004.Google Scholar
  15. 103.
    W-N. Chin, F. Craciun, S. Qin, and M. C. Rinard. Region inference for an object-oriented language. In PLDI, pages 243–254, 2004.Google Scholar
  16. 104.
    J-D. Choi, M. Gupta, M. J. Serrano, V. C. Sreedhar, and S. P. Midkiff. Stack allocation and synchronization optimizations for Java using escape analysis. ACM Trans. Program. Lang. Syst., 25(6):876–910, 2003.Google Scholar
  17. 106.
    P. Clauss. Counting solutions to linear and nonlinear constraints through ehrhart polynomials: Applications to analyze and transform scientific programs. In International Conference on Supercomputing, pages 278–285, 1996.Google Scholar
  18. 109.
    A. Corsaro and R. Cytron. Efficient memory-reference checks for real-time Java. In LCTES, pages 51–58, 2003.Google Scholar
  19. 110.
    A. Corsaro and C. Santoro. Design patterns for RTSJ application development. In OTM Workshops, pages 394–405, 2004.Google Scholar
  20. 112.
    A. Corsaro and D.C. Schmidt. The design and performance of real-time Java middleware. IEEE Transactions on Parallel and Distributed Systems, 14(11):1155–1167, November 2003.CrossRefGoogle Scholar
  21. 126.
    M. Deters and R. Cytron. Automated discovery of scoped memory regions for real-time Java. In MSP/ISMM, pages 132–142, 2002.Google Scholar
  22. 129.
    P. Dibble. RTSJ 1.1 alpha 6 release notes. Available at
  23. 130.
    P. Dibble. The current status of the RTSJ and jsr 282. In Proceedings of the 4th International Workshop on Java Technologies for Real-time and Embedded Systems, JTRES ’06, pages 1–1, New York, NY, USA, 2006. ACM.Google Scholar
  24. 131.
    P. Dibble and et al. Java Specification Request 282 (RTSJ 1.1). Available at
  25. 133.
    P. Dibble and A.J. Wellings. Jsr-282 status report. In Proceedings of the 7th International Workshop on Java Technologies for Real-Time and Embedded Systems, JTRES’09, pages 179–182, New York, NY, USA, 2009. ACM.Google Scholar
  26. 134.
    P.C. Dibble. Real-Time Java Platform Programming. Amazon, 2nd edition, 2008.Google Scholar
  27. 135.
    S. Dieckmann and U. Hölzle. A study of the allocation behavior of the SPECjvm98 Java benchmark. In ECOOP, pages 92–115, 1999.Google Scholar
  28. 137.
    E.W. Dijkstra, L. Lamport, A. J. Martin, C. S. Scholten, and E. F. M. Steffens. On-the-fly garbage collection: An exercise in cooperation. In Lecture Notes in Computer Science, No. 46. Springer-Verlag, New York, 1976.Google Scholar
  29. 161.
    A. Ferrari, D. Garbervetsky, V. A. Braberman, P. Listingart, and S. Yovine. Jscoper: Eclipse support for research on scoping and instrumentation for real time Java applications. In ETX, pages 50–54, 2005.Google Scholar
  30. 164.
    D. Garbervetsky, C. Nakhli, S. Yovine, and H. Zorgati. Program instrumentation and run-time analysis of scoped memory in Java. Electr. Notes Theor. Comput. Sci., 113:105–121, 2005.CrossRefGoogle Scholar
  31. 165.
    D. Garbervetsky, S. Yovine, V. A. Braberman, M. Rouaux, and A. Taboada. Quantitative dynamic-memory analysis for Java. CCPE, (doi: 10.1002/cpe.1656), Nov 2010.Google Scholar
  32. 170.
    D. Gay and A. Aiken. Memory management with explicit regions. In PLDI, pages 313–323, 1998.Google Scholar
  33. 171.
    D. Gay and B. Steensgaard. Fast escape analysis and stack allocation for object-based programs. In CC, pages 82–93, 2000.Google Scholar
  34. 191.
    R. Henriksson. Scheduling Garbage Collection in Embedded Systems. PhD thesis, Lund Institute of Technology, July 1998.Google Scholar
  35. 196.
    M.T. Higuera-Toledano. Hardware-based solution detecting illegal references in real-time Java. In ECRTS, pages 229–237, 2003.Google Scholar
  36. 198.
    M.T. Higuera-Toledano. Towards an understanding of the behavior of the single parent rule in the RTSJ scoped memory model. In IEEE Real-Time and Embedded Technology and Applications Symposium, pages 470–479, 2005.Google Scholar
  37. 200.
    M.T. Higuera-Toledano. Towards an analysis of race carrier conditions in real-time Java. In IPDPS, 2006.Google Scholar
  38. 201.
    M.T. Higuera-Toledano and V. Issarny. Improving the memory management performance of RTSJ. Concurrency and Computation: Practice and Experience, 17(5–6):715–737, 2005.CrossRefGoogle Scholar
  39. 202.
    M.T. Higuera-Toledano, V. Issarny, M. Banâtre, G. Cabillic, JP. Lesot, and F. Parain. Region-based memory management for real-time Java. In ISORC, pages 387–394, 2001.Google Scholar
  40. 203.
    M.T. Higuera-Toledano, V. Issarny, M. Banâtre, and F. Parain. Memory management for real-time Java: An efficient solution using hardware support. Real-Time Systems, 26(1):63–87, 2004.CrossRefGoogle Scholar
  41. 205.
    M. Hirzel, J. Henkel, A. Diwan, and M. Hind. Understanding the connectivity of heap objects. In MSP/ISMM, pages 143–156, 2002.Google Scholar
  42. 211.
    R.L. Hudson, R. Morrison, J.E.B. Moss, and D.S. Munro. Garbage collecting the world: one car at a time. SIGPLAN Not., 32:162–175, October 1997.CrossRefGoogle Scholar
  43. 231.
    R.E. Jones and R. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. Wiley, Chichester, July 1996. With a chapter on Distributed Garbage Collection by R. Lins.Google Scholar
  44. 233.
    T. Kalibera, J. Hagelberg, F. Pizlo, A. Plsek, B. Titzer, and J. Vitek. Cdx: a family of real-time Java benchmarks. In JTRES’09: Proceedings of the 7th International Workshop on Java Technologies for Real-Time and Embedded Systems, pages 41–50, New York, NY, USA, 2009. ACM.Google Scholar
  45. 235.
    A. Kim and J.M. Chang. Designing a Java microprocessor core using fpga technology. IEE Computing & Control Engineering Journal, 11(3):135–141, June 2000.CrossRefGoogle Scholar
  46. 297.
    F. Pizlo, J. M. Fox, D. Holmes, and J. Vitek. Real-time Java scoped memory: Design patterns and semantics. In Proceedings of the 7th IEEE International Symposium on Object-Oriented Real-Time Distributed Computing (ISORC 2004), pages 101–110, 2004.Google Scholar
  47. 304.
    A. Plsek, L. Zhao, V.H. Sahin, D. Tang, T. Kalibera, and J. Vitek. Developing safety critical Java applications with oSCJ/L0. In JTRES, pages 95–101, 2010.Google Scholar
  48. 313.
    K. Raman, Y. Zhang, M. Panahi, J.A. Colmenares, and R. Klefstad. Patterns and tools for achieving predictability and performance with real-time Java. In RTCSA’05: Proceedings of the 11th IEEE International Conference on Embedded and Real-Time Computing Systems and Applications (RTCSA’05), pages 247–253, Washington, DC, USA, 2005. IEEE Computer Society.Google Scholar
  49. 328.
    T. Ritzau and P. Fritzson. Decreasing memory overhead in hard real-time garbage collection. In EMSOFT, pages 213–226, 2002.Google Scholar
  50. 339.
    G. Salagnac, C. Rippert, and S. Yovine. Semi-automatic region-based memory management for real-time Java embedded systems. In RTCSA, pages 73–80, 2007.Google Scholar
  51. 340.
    G. Salagnac, S. Yovine, and D. Garbervetsky. Fast escape analysis for region-based memory management. Electr. Notes Theor. Comput. Sci., 131:99–110, 2005.CrossRefGoogle Scholar
  52. 341.
    A. Salcianu and M. C. Rinard. Pointer and escape analysis for multithreaded programs. In PPOPP, pages 12–23, 2001.Google Scholar
  53. 362.
    T. Schoofs, E. Jenn, S. Leriche, K. Nilsen, L. Gauthier, and M. Richard-Foy. Use of perc pico in the AIDA avionics platform. In JTRES, pages 169–178, 2009.Google Scholar
  54. 366.
    J. Seligmann and S. Grarup. Incremental mature garbage collection using the train algorithm. In Proceedings of the 9th European Conference on Object-Oriented Programming, ECOOP’95, pages 235–252, London, UK, UK, 1995. Springer-Verlag.Google Scholar
  55. 370.
    F. Siebert. Eliminating external fragmentation in a non-moving garbage collector for Java. In Proceedings of the 2000 international conference on Compilers, architecture, and synthesis for embedded systems (CASES 2000), pages 9–17, New York, NY, USA, 2000. ACM.Google Scholar
  56. 373.
    F. Siebert. Realtime garbage collection in the JamaicaVM 3.0. In JTRES, pages 94–103, 2007.Google Scholar
  57. 394.
    Sun Microsystems. picojava-ii(tm) microarchitecture guide, March 1999.Google Scholar
  58. 396.
    Sun Microsystems. The Javahotspot virtual machine, v1.4.1, 2002.Google Scholar
  59. 412.
    M. Tofte, L. Birkedal, M. Elsman, and N. Hallenberg. A retrospective on region-based memory management. Higher-Order and Symbolic Computation, 17(3):245–265, 2004.zbMATHCrossRefGoogle Scholar
  60. 413.
    M. Tofte and JP. Talpin. Region-based memory management. Inf. Comput., 132(2):109–176, 1997.Google Scholar
  61. 432.
    J. Whaley and M. C. Rinard. Compositional pointer and escape analysis for Java programs. In OOPSLA, pages 187–206, 1999.Google Scholar
  62. 438.
    P. Wilson. Uniprocessor garbage collection techniques. In Yves Bekkers and Jacques Cohen, editors, Memory Management, volume 637 of Lecture Notes in Computer Science, pages 1–42. Springer Berlin / Heidelberg, 1992. 10.1007/BFb0017182.Google Scholar
  63. 450.
    B. Zorn. Barrier methods for garbage collection. Technical Report CU-CS-494-90, University of Colorado, November 1990.Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2012

Authors and Affiliations

  • M. Teresa Higuera-Toledano
    • 1
  • Sergio Yovine
    • 2
  • Diego Garbervetsky
    • 3
  1. 1.Universidad Complutense de MadridMadridSpain
  2. 2.CONICET, Departamento de Computación, FCENUniversidad de Buenos AiresBuenos AiresArgentina
  3. 3.Departamento de Computación, FCENUniversidad de Buenos AiresBuenos AiresArgentina

Personalised recommendations