Questions tagged [mmap]

All about using memory mapped files. Questions on programming should be asked on Stack Overflow SE.

mmap() is a system call that allows for very fast and convenient file I/O. A file that is mapped into memory can be accessed like any memory region.

mmap() can also be used for inter-process communication: a process that creates an anonymous mapping that is not backed by any file can share this region with any child process since memory mappings are preserved across fork().

Note that pipes and socket cannot be mapped.

80 questions
3
votes
1 answer

mmap a file vs mmap in malloc

I'm kind of confused by mmap. Well, I know that when we malloc a big size of memory, we will invoke the function mmap, which will allocate an area in memory. In this case, mmap just allocate some memory for some process. However, I've heard that…
Yves
  • 3,291
2
votes
1 answer

Mmaping tremendously large files

I have a very large disk drive (2TB), but not very much RAM (8GB). I'd like to be able to run some big data experiments on a large file (~200GB) that exists on my disk's filesystem. I understand that will be very expensive in terms of disk…
1
vote
1 answer

mmap(): Is it possible to prevent writing back to file with MAP_SHARED flag?

As I understand, 'MAP_SHARED' flag in mmap() shares any changes made by a process to the memory map immediately with other processes and eventually writes the changes back to the file. Is it possible to share the in-memory changes with other…
0
votes
1 answer

In what segment does mmap allocate memory

I thought first that it was the heap, but it seems to allocate memory in a different place. radare2 tags it as folowing: 0x00007fb07dacd000 - 0x00007fb07dace000 - usr 4K s rw- unk2 unk2 Since it is not the heap, what do we call the segment where…
Aramya
  • 37
0
votes
1 answer

mmap - map to address above 2^48

I understand that the used address space of 64-bit PCs is [0,2^48), but can I use mmap to map a file to an address above 248? I wrote the following code but found out the mapped address was still inside [0,2^48). int main(void) { const char*…
z.h.
  • 994