I'm allocating a rather large, roughly 100GB, chunk of memory. The exact size is always known at compile time.
Should I be allocating statically?
static char data[DATA_SIZE];
Or using mmap?
data = mmap(NULL, DATA_SIZE, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE|MAP_LOCKED|MAP_UNINITIALIZED, -1, 0)
With the former, the application (ignoring start-up time) seems to be running marginally faster.
Ignoring failed allocations, what are the pros and cons of each approach?