| ![]() |
New dimensions in heap profiling
Colin Runciman Niklas R?ojemo
Dept. of Computer Science Dept. of Computer Science
University of York Chalmers University
York YO1 5DD S-412 96 Gothenburg
England Sweden
[email protected] [email protected]
July 1994 (revised February 1995)
Abstract
First-generation heap profilers for lazy functional languages have proved to be effective tools for locating some kinds of space faults, but in other cases they cannot provide sufficient information to solve the problem. This paper describes the design, implementation and use of a new profiler that goes beyond the two-dimensional `who produces what' view of heap cells to provide information about their more dynamic and structural attributes. Specifically, the new profiler can distinguish between cells according to their eventual lifetime, or on the basis of the closure retainers by virtue of which they remain part of the live heap. A bootstrapping Haskell compiler (nhc) hosts the implementation: among examples of the profiler's use we include self-application to nhc. Another example is the original heap-profiling case study clausify, which now consumes even less memory and is much faster.
1 Introduction
Purely functional languages are attractive for their concise uncluttered style | a style made possible by freeing the programmer from many responsibilities such as memory management and evaluation strategy. There is a drawback however. Lazy functional programs that look concise and elegant as collections of equations can make surprisingly large demands on machine resources. The programmer sees only recursion equations, but the machine performs normal order graph reduction using those equations as rules. So it may be easy to reason about the results obtained, yet hard to reason about the costs of obtaining them.