#include mmap in use // the -1 could be a file descriptor instead here // PROT_EXEC also ** void * vsbase = mmap(NULL, orig_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); if (vsbase == MAP_FAILED) { perror("memory::allocate: mmap failed"); exit(1); } long long int ibase = (long long int) vsbase; if (ibase & (sizeof(cons_cell) - 1) != 0) { fprintf(stderr, "Warning: base address %016llX not properly aligned\n", vsbase); ibase = (ibase + sizeof(cons_cell) - 1) & ~ (sizeof(cons_cell) - 1); num_cells -= 1; } cells = (cons_cell *) ibase; printf("cells = %lld\n", cells); for (ulli i = 0; i < num_cells; i += 1) cells[i].cdr = (ulli) (cells + i + 1); cells[num_cells - 1].cdr = 0; first_free = cells; printf("allocate, first_free = %lld\n", first_free); } giving it back int r = munmap(vsbase, orig_size); if (r < 0) ... error ... also madvise(vsbase, orig_size, behaviour); behaviour is one of MADV_RANDOM no prefetch MADV_SEQUENTIAL deprioritise previous page MADV_WILLNEED increase priority MADV_DONTNEED opposite and others