i was 'asked' to generalize my memmapping idea to work for every process on a system. this became relevant for me when doing a large build on an android phone. after brief websearch, my approach was to fork microsoft's 'mimalloc' userspace allocator to provide for memmapping files on use. my fork is in the 'vmem' branch of https://github.com/xloem/mimalloc . it is a quick hack and may abort when subject to weird fork races etc. it also may let you run arbitrarily large processes on phones and raspberry pis. it makes one swapfile per process,and only cleans the swapfile up if the process terminates normally (atext() call). somebody with more systems experience than me could probably speed it up and stabilise it without much work. # to install: git clone https://github.com/xloem/mimalloc cd mimalloc git checkout vmem mkdir build cd build cmake .. make install # to enable: export LD_PRELOAD=/path/to/mimalloc.so VMEM_PREFIX=/path/to/swapfile # now processes run in this shell use per-process swapfiles