Last Updated:   Sep / 18 / 2012

fsmem: Filesytem Memory Library

© 2012 Aaron Vose

Download the current version with source code here:


I created a software library which allows applications to use space on disk instead of RAM for malloc()-based memory. While swap space in Linux is nice, it is very uncommon to create an install with a large (think terabytes) swap partition. Additionally, one might not want to dedicate that much disk space to swap all the time. The fsmem library allows one to enable a specific application to use files on disk for memory instead. This is done by memory mapping large files and then allowing ptmalloc to carve them up transparently. One should be able to download the source which will produce "libptmalloc3.a" when built. Linking with this file will cause the linked application to create a 1 terabyte file on disk which will be carved up into smaller blocks as needed by malloc(). The current version uses a single large file, but future versions will be able to grow the file / use multiple files.

The PDF linked to above includes more details and some build instructions.