Garbage Collection, and Memory Efficiency, in Lazy Functional Languages
暂无分享,去创建一个
Automatic memory management is an important concept in many high order languages. It improves productivity by abstracting away from memory management, but it is not free! The cost can sometimes be much higher than the programmer thought. This is especially true for lazy functional languages where it is not always obvious when things are evaluated. This thesis describes two ways to decrease the overhead. Faster garbage collectors and tools to aid programmers writing more efficient programs. The first two papers are examples of improved garbage collectors. One is intended for a parallel machine, the other is for sequential machines. Both use generational garbage collectors to decrease the garbage collection time. Neither of them need the usual test-before-update used in other generational collectors. The test could be avoided by taking advantage of the fact that only redexes are updated in functional languages, and then only after they have been evaluated. The third paper describes an extended version of heap profiling. This is a tool that helps programmers produce more memory efficient programs. In the extended version not only static information can be profiled, but also some dynamic properties can be observed. This aids the programmer in writing even faster and more space efficient programs. The gain in speed can be higher than using an infinitely fast garbage collector, since also the time to allocate the memory goes away. The last two papers are examples of memory efficient implementations. The first of these papers describes a fast and space efficient implementation of parsing combinators, the second gives an overview of a Haskell compiler. This Haskell compiler is not only written in a memory efficient manner, it also tries to produce space efficient code. Some of the methods to decrease memory usage in the compiler can be used in other lazy functional programs, not only compilers.