文档介绍:Region-based off-heap memory for Scala Technical report Denys Shabalin, Martin Odersky ?rst.******@ep?.ch February 2, 2015 Introduction At the moment, the Scala programming language offers a single memory management model for heap-allocated memory: fully automatic garbage collection. In theory, this approach lets the pletely forget about memory management as GC will automatically deallocate objects for them whenever it considers them to be unreachable. Unfortunately, in practice GC has non-trivial performance trade-offs that might not be acceptable in some applications. The goal of this project is to explore an alternative memory model: region- based memory. The main idea behind this model is to let developers annotate special scopes in code as regions and provide an APIs to allocate memory that would stay available until the execution leaves the scope. Once execution leaves the scope, all of the memory associated with it can be freed at once in one pass. Regions are also know as memory pools, arenas or memory contexts and are in fact widely used in the C/C++ code bases as a means to ef?ciently manage objects with clear explicitly delimited lifetime. This approach is used in a number of high-pro?le projects such as Apache HTTP server, PostgreSQL and Google Chrome. Apache memory pools [1] . This API is quite representative of how one might implement regions in C. D