c - what scenarios we set file descriptor as -1 in mmap? -


why mmap better read , write

one more similar post

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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -