Dynamic space limits for Haskell

We describe the semantics and implementation of a space limits system for Haskell, which allows programmers to create resource containers that enforce bounded resident memory usage at runtime. Our system is distinguished by a clear allocator-pays semantics drawn from previous experience with profiling in Haskell and an implementation strategy which uses a block-structured heap to organize containers, allowing us to enforce limits with high accuracy. To deal with the problem of deallocating data in a garbage collected heap, we propose a novel taint-based mechanism that unifies the existing practices of revocable pointers and killing threads in order to reclaim memory. Our system is implemented in GHC, a production-strength compiler for Haskell.

[1]  Guy L. Steele Data Representations in PDP-10 MACLISP , 1977 .

[2]  Peter Druschel,et al.  Resource containers: a new facility for resource management in server systems , 1999, OSDI '99.

[3]  Simon L. Peyton Jones,et al.  Asynchronous exceptions in Haskell , 2001, PLDI '01.

[4]  J. Gregory Morrisett,et al.  Monadic regions , 2004, ICFP '04.

[5]  Matthew Flatt,et al.  Memory accounting without partitions , 2004, ISMM '04.

[6]  Simon L. Peyton Jones,et al.  Time and space profiling for non-strict, higher-order functional languages , 1995, POPL '95.

[7]  Wilson C. Hsieh,et al.  The KaffeOS Java runtime system , 2005, TOPL.

[8]  R. Kent Dybvig,et al.  Don't Stop the BIBOP: Flexible and Ecient Storage Management for Dynamically Typed Languages , 1994 .

[9]  Deian Stefan,et al.  Hails: Protecting Data Privacy in Untrusted Web Applications , 2012, OSDI.

[10]  Thorsten von Eicken,et al.  JRes: a resource accounting interface for Java , 1998, OOPSLA '98.

[11]  Marco Gaboardi,et al.  Upper Bounds on Stream I/O Using Semantic Interpretations , 2009, CSL.

[12]  Werner Vogels,et al.  Dynamo: amazon's highly available key-value store , 2007, SOSP.

[13]  Martin Elsman,et al.  Combining region inference and garbage collection , 2002, PLDI '02.

[14]  Carl A. Gunter,et al.  PLAN: a packet language for active networks , 1998, ICFP '98.

[15]  Simon L. Peyton Jones,et al.  Parallel generational-copying garbage collection with a block-structured heap , 2008, ISMM '08.

[16]  Dan S. Wallach,et al.  Garbage collector memory accounting in language-based systems , 2003, 2003 Symposium on Security and Privacy, 2003..

[17]  C. Hawblitzel,et al.  Luna: a flexible Java protection system , 2002, OSDI '02.

[18]  Deian Stefan,et al.  Disjunction Category Labels , 2011, NordSec.

[19]  Eddie Kohler,et al.  Making information flow explicit in HiStar , 2006, OSDI '06.

[20]  Alastair David Reid Putting the Spine Back in the Spineless Tagless G-Machine: An Implementation of Resumable Black-Holes , 1998, IFL.

[21]  J. Shapiro,et al.  EROS: a fast capability system , 2000, OPSR.

[22]  Simon Peyton Jones,et al.  Safe haskell , 2013 .

[23]  Will Partain,et al.  The nofib Benchmark Suite of Haskell Programs , 1992, Functional Programming.

[24]  George C. Necula,et al.  Proof-Carrying Code , 2011, Encyclopedia of Cryptography and Security.

[25]  Deian Stefan,et al.  Flexible dynamic information flow control in Haskell , 2012, Haskell '11.

[26]  Michael Franz,et al.  Compartmental memory management in a modern web browser , 2011, ISMM '11.

[27]  Simon L. Peyton Jones,et al.  Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine , 1992, Journal of Functional Programming.