login

Tail recursion without space leaks

Journal of Functional ProgrammingPublished 1 January 1992Open access
Richard Jones
Citations40
SJR quartileQ3
SJR score0.33
SNIP0.73
View PDF

TL;DR

Why a particular form of space leak occurs in the G-machine is analyzed, and some ideas for fixing this problem are presented.

Abstract

Abstract The G-machine (Johnsson, 1987; Peyton Jones, 1987) is a compiled graph reduction machine for lazy functional languages. The G-machine compiler contains many optimizations to improve performance. One set of such optimizations is designed to improve the performance of tail recursive functions. Unfortunately, the abstract machine is subject to a space leak—objects are unnecessarily preserved by the garbage collector. This paper analyses why a particular form of space leak occurs in the G-machine, and presents some ideas for fixing this problem. This phenomena in other abstract machines is also examined briefly.

Keywords

Computer ScienceBiochemistry, Genetics and Molecular Biology