Re: how can i free the physical memory in standby pages

Tech-Archive recommends: Speed Up your PC by fixing your registry



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
.



Relevant Pages

  • Re: Over used cache memory?
    ... All unused memory will be put to good use as cache. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Should I worry my servers memory?
    ... The major difference is "cached" grew ... When they start an application that require much memory, ... some unused memory that very soon will be used as cache again. ... Since you never power down unused memory, why not use it as cache? ...
    (alt.os.linux)
  • Re: memory utilization went high on solaris.
    ... memory is never given up unless needed. ... >>(I.e., for each new file cached, the jkernel prefers ... >>to take unused memory rather than memory used to ... > Is there a command to flush this kind of cache? ...
    (comp.unix.solaris)
  • Re: Cached memory never gets released
    ... Stock linux 2.4.26 kernel. ... Due to flash bug 3M of memory gets lost due to font memory getting lost ... The output of "free" cache number steadily grows. ... longer to exhaust all of system memory with the cache. ...
    (Linux-Kernel)
  • Re: Problem: Creating a raw binary string
    ... > While its true that a 64-bit cpu will move twice the data per instruction it ... > Memory bus width plays an important role here and unless it too is widened / ... You are forgetting the two levels of cache in the processor. ... The memory chips are addressed in Row col fashion. ...
    (alt.comp.lang.borland-delphi)