Region-Based Memory Management in Java
暂无分享,去创建一个
We present a Java-like language in which objects are explicitly put in regions. The language has constructs for allocating, updating and deallocating regions, as well as region types for objects. For this language we present a static semantics ensuring that well-typed programs use regions safely, and we present a dynamic semantics that is intentional with respect to a region-based store. We formulate and prove a soundness theorem stating that well-typed programs do not go wrong. Finally, we develop a concrete model for implementing regions, and we compare this model to garbage collection for small examples. Preface When we rst started working on this thesis, in January 1998, we expected to do a fairly programming intensive project. We expected to do a lot of experimenting with Java, and we had hoped to implement a prototype compiler for Java with region-based memory management. As we began to get a notion of the di culty of the task, our questions changed from How can we do this? to Can this be done at all? . We then started an intensive investigation of how to de ne a subset of Java that uses regions explicitly. After a couple of months we had designed the semantics of this language, RegJava, and we asked ourselves: Is the system sound? . This proof of soundness turned out to be very time consuming, but also to be essential for the development of good semantics. We have torn down and rebuilt both the semantics and the proof more times than we care to remember. The semantics and the proof of soundness presented here have not sprung spontaneously into life like Athena from the brow of Zeus, but they are products of a long trial-and-error process. We could likely go on with this process for another six months if we had the time. There are lots of interesting notions and open problems we have not yet explored. All things must come to an end, though, and this is the point where we have had to stop. From the beginning of the project, it has been an important goal to live up to the curriculum at DIKU and nish this thesis within a 6 month period. Our frequent discussions with our advisor, Fritz Henglein, have contributed much to this process of growth and exploration. He has provided many useful and interesting ideas, and while not all these ideas worked out well, they all helped increase our understanding. We are also grateful to Henning Niss for his e orts with proofreading this thesis and suggesting improvements and clari cations. 1
[1] Bjarne Stroustrup,et al. The C++ programming language (2nd ed.) , 1991 .