Mlock/mlockall/munlock To prevent a region of memory from being swapped to disk, use the following call: r = mlock( ptr , size );