Re: how can i free the physical memory in standby pages
- From: Bruse Peng <peng.xiaoyu@xxxxxxxxx>
- Date: Wed, 19 Dec 2007 07:59:03 -0800 (PST)
On 12月19日, 下午11时20分, "Arnie" <No...@xxxxxxxx> wrote:
"Bruse Peng" <peng.xia...@xxxxxxxxx> wrote in message
news:1565e386-019c-4a14-9568-3a781f62d24e@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hi
in my program, i have to read some part of a large file ( > 1GB),
randomly thousands of time.
i use the file mapping API, create a file handle and a filemapping
handle at the beginning . when i have to do one read operation, i
open a mapviewoffile, memcpy, unmap it immediately after read
completion
it works , but it causes the windows swaps out other un-using
process's pages to page file. it's very obvious when i run my program
over 20minutes. i feel the lag when i bring some unusing program to
front :(
i think that windows may consider those pages related to the big file
are hot pages and mark them as standby pages even they are ummaped.
so i wonder how i can free these pages or prevent swaping out other
process's pages ?
someone tell me that close all handler associated with the large file
will cause windows do some cleanup work, is that true? or i have to
using NO_BUFFERING file i/o and do cache myself? any hints here
regards
I'm not sure if this is what you're looking for or not. The call below will
release the process' unused memory back to the OS. Be aware though that
if/when you need the memory back it will have to be reallocated from the OS.
See the MSDN doc for additional information.
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
- Arnie
AFAIK, SetProcessWorkingSetSize() just swap the process's unused
memory to page file, do not free the global page cache.
the working set of the process is not high and not increasing, but the
available number of free pages becomes lower and lower
so what i want is to reduce the page cache
thank you all the same
Bruse
.
- References:
- how can i free the physical memory in standby pages
- From: Bruse Peng
- Re: how can i free the physical memory in standby pages
- From: Arnie
- how can i free the physical memory in standby pages
- Prev by Date: Re: how can i free the physical memory in standby pages
- Next by Date: Re: Many programs freezing on file system read/write - due to NTFS driver lock?
- Previous by thread: Re: how can i free the physical memory in standby pages
- Next by thread: Re: how can i free the physical memory in standby pages
- Index(es):
Relevant Pages
|