Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBacterius

Posted 16 July 2013 - 09:37 PM

Have you tried passing the FILE_FLAG_RANDOM_ACCESS flag to CreateFile? It advises the OS you will be doing random access on that file so it may reclaim the virtual memory pages more quickly. Ideal behaviour in your case would be caching the last few megabytes read in case you suddenly start reading sequentially, but no further to avoid exhausting physical memory, and I would expect the OS to do just that.

So, yeah, try the flag to see if it does anything. Either way Windows isn't going to be running a statistical analysis on your memory access patterns to figure out how best to manage your huge mapping, though I admit it is kind of dumb just letting the system run out of memory like that.


#1Bacterius

Posted 16 July 2013 - 09:36 PM

Have you tried passing the FILE_FLAG_RANDOM_ACCESS flag to CreateFile? It advises the OS you will be doing random access on that file so it may reclaim the virtual memory pages more quickly. Ideal behaviour in your case would be caching the last few megabytes read in case you suddenly start reading sequentially, but no further to avoid exhausting physical memory, and I would expect the OS to do just that.

So, yeah, try the flag to see if it does anything. Either way windows isn't going to be running a statistical analysis of your memory access patterns to figure out how best to manage your huge mapping, though I admit it is kind of dumb just letting the system run out of memory like that.

PARTNERS