Counting Immutable Beans: Reference Counting Optimized for Purely Functional Programming

08/15/2019
by   Sebastian Ullrich, et al.
0

Most functional languages rely on some garbage collection for automatic memory management. They usually eschew reference counting in favor of a tracing garbage collector, which has less bookkeeping overhead at runtime. On the other hand, having an exact reference count of each value can enable optimizations, such as destructive updates. We explore these optimization opportunities in the context of an eager, purely functional programming language. We propose a new mechanism for efficiently reclaiming memory used by nonshared values, reducing stress on the global memory allocator. We describe an approach for minimizing the number of reference counts updates using borrowed references and a heuristic for automatically inferring borrow annotations. We implemented all these techniques in a new compiler for an eager and purely functional programming language with support for multi-threading. Our preliminary experimental results demonstrate our approach is competitive and often outperforms state-of-the-art compilers.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
07/04/2018

A Purely Functional Computer Algebra System Embedded in Haskell

We demonstrate how methods in Functional Programming can be used to impl...
research
05/27/2021

Hailstorm : A Statically-Typed, Purely Functional Language for IoT Applications

With the growing ubiquity of Internet of Things(IoT), more complex logic...
research
04/12/2022

Turning Manual Concurrent Memory Reclamation into Automatic Reference Counting

Safe memory reclamation (SMR) schemes are an essential tool for lock-fre...
research
03/29/2018

The process of purely event-driven programs

Using process algebra, this paper describes the formalisation of the pro...
research
01/14/2018

Hierarchical Memory Management for Mutable State

It is well known that modern functional programming languages are natura...
research
03/02/2021

Implementing G-Machine in HyperLMNtal

Since language processing systems generally allocate/discard memory with...
research
03/22/2023

Practical compilation of fexprs using partial evaluation: Fexprs can performantly replace macros in purely-functional Lisp

Macros are a common part of Lisp languages, and one of their most lauded...

Please sign up or login with your details

Forgot password? Click here to reset