Fractional Ownerships for Safe Memory Deallocation

  • Authors:
  • Kohei Suenaga;Naoki Kobayashi

  • Affiliations:
  • Tohoku University,;Tohoku University,

  • Venue:
  • APLAS '09 Proceedings of the 7th Asian Symposium on Programming Languages and Systems
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

We propose a type system for a programming language with memory allocation/deallocation primitives, which prevents memory- related errors such as double-frees and memory leaks. The main idea is to augment pointer types with fractional ownerships, which express both capabilities and obligations to access or deallocate memory cells. By assigning an ownership to each pointer type constructor (rather than to a variable), our type system can properly reason about list/tree-manipulating programs. Furthermore, thanks to the use of fractions as ownerships, the type system admits a polynomial-time type inference algorithm, which serves as an algorithm for automatic verification of lack of memory-related errors. A prototype verifier has been implemented and tested for C programs.