0

I need to sort a large file. I'm going to load a segment of a file that fits in memory, sort it by quick sort, write on disk. Then merge the sorted parts. To do this, I need to allocate the maximum amount of memory. But only in memory without paging. How do I do this?

slou_pc
  • 9
  • 2
  • This is one of those "how long is a piece of string" questions, but this might help: https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-globalmemorystatusex – Paul Sanders Jul 09 '20 at 23:27
  • 2
    As soon as you allocate this amount of memory, some other program will allocate some memory and that will cause paging – user253751 Jul 09 '20 at 23:27
  • Is any way to prevent it? Use no-pulled memory? Get high "memory priority"? Or all I can ask user not run programs? – slou_pc Jul 09 '20 at 23:34
  • How do mapped file help me? I need to divide physical memory and disk. At start quick sort segments on physical memory. Then merge sorting segments from disk – slou_pc Jul 09 '20 at 23:39
  • 1
    @slou_pc Instead of guessing what's best in your case - study your case and make a best guess and go from there. Memory mapped files solves some problems. They are not a generic solution to performance hits. – Ted Lyngmo Jul 10 '20 at 00:15

0 Answers0