c - what scenarios we set file descriptor as -1 in mmap? -
my question follows: there scenarios people using mmap rather read files. 1 such code is:
*mapping = mmap(null, *mapping_size, prot_read | prot_write, map_populate | map_anonymous | map_private, -1, 0);
the above code tries allocate huge amount of memory. want know mmap in case, how works. talks advantage of mmap wrt files. these kinds of code fd set -1 frequent. mean, advantages of doing so.? wish can clear doubt, couldn't ask due ambiguity.
thank you
it 1 method used map dynamic (new) memory application. libc implementing malloc() (and friends), 1 possible technique allocating memory
Comments
Post a Comment