Increasingly popular languages such as Java and C# require efficient garbage collection. This paper presents the design, implementation, and evaluation of MMTk, a Memory Management Toolkit for and in Java. MMTk is an efficient, composable, extensible, and portable framework for building garbage collectors. MMTk uses design patterns and compiler cooperation to combine modularity and efficiency. The resulting system is more robust, easier to maintain, and has fewer defects than monolithic collectors. Experimental comparisons with monolithic Java and C implementations reveal MMTk has significant performance advantages as well. Performance critical system software typically uses monolithic C at the expense of flexibility. Our results refute common wisdom that only this approach attains efficiency, and suggest that performance critical software can embrace modular design and high-level languages.
IntroductionThe tension between flexibility and performance pervades systems development. Flexibility assists in rapidly realizing new ideas, and good base performance gives the realizations credibility. This paper is a case study in a systems research context that shows flexibility can actually improve rather than degrade performance.Programmers are increasingly choosing object-oriented languages with automatic memory management (garbage collection) because of their software engineering benefits. Although researchers have studied garbage collection for a long time [2,19,20,25,27,34], this reliance on it and growing locality effects have made garbage collection research a high priority in academia [13,17,26,30,32] and industry [8,9,10]. Many collector implementations are monolithic and do not share reused components [1,21]. Performance comparisons across a range of approaches is thus problematic and rare [4,7,21].