1

Let's suppose that there is a large file. The mmap function cannot handle it entirely. But we need to read as large parts of this file as possible.

I found that this command in Unix allows us to find the mmap size:

sysctl vm.max_map_count

The output is: vm.max_map_count = 65530.

However, it doesn't work in C program. How to find the size of map function in C program?

Marat
  • 29
  • 5
  • Seems to me you have misunderstood the parameter. See https://stackoverflow.com/questions/11683850/how-much-memory-could-vm-use – Support Ukraine Mar 28 '19 at 07:00

1 Answers1

0

There is no limit on how big mmappings are (except for the bits in size_t), as the kernel never needs to load the entire thing into memory at once. mmap() is the method of choice for reading files larger than your memory: Just map the file, and let the kernel worry about the rest...

cmaster - reinstate monica
  • 38,891
  • 9
  • 62
  • 106