http://stxxl.sourceforge.net
<beckmann@cs.uni-frankfurt.de>
http://www.boost.org/LICENSE_1_0.txt
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sys/mman.h>
#include <unistd.h>
int main(int argc, char ** argv)
{
if (argc == 2) {
long M = atol(argv[1]);
if (M > 0) {
char * c = (char *)malloc(M);
for (long i = 0; i < M; ++i)
c[i] = 42;
if (mlock(c, M) == 0) {
std::cout << "mlock(, " << M << ") successful, press Ctrl-C to finish" << std::endl;
while (1)
sleep(86400);
} else {
std::cerr << "mlock(, " << M << ") failed!" << std::endl;
return 1;
}
}
} else {
std::cout << "Usage: " << argv[0] << " <bytes>" << std::endl;
}
}