sureshrps has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, when my code starts before the system Page file size is very low. But once start my code, the page file size is increasing continuously. In my code, calling so many perl exe files. i want to refresh page file using my code or any separate code. waiting for your valuable response Thanks Suresh
  • Comment on how to refresh Pagefile size in windows 2003 server

Replies are listed 'Best First'.
Re: how to refresh Pagefile size in windows 2003 server
by cdarke (Prior) on Sep 16, 2009 at 12:50 UTC
    Refreshing a pagefile size is really a question for Microsoft rather than here.

    The page file is used for virtual memory, and if it is increasing as you say then you are probably trying to run too much at the same time. So the answer is to use less memory.

    Try running fewer programs at the same time, and make sure your code is written efficiently.
    For example, avoid reading a whole file into an array unless you really have to. Break-up monolithic code into subroutines using lexical (my) variables. Benchmark and profile your code to find the areas using the most memory and work on those.

    Without specific examples we cannot give anything other than general (and obvious) comments like this.
      Thanks for valuable reply. I understood your comments. My server contains 4 GB RAM. If the page file size is around 3.5 GB then the server was hanged. page file size 400 MB when the server is restarted. Is there any option to reduce this page file usage automatically or clear page file while running the server. Thanks Suresh
        Is there any option to reduce this page file usage automatically or clear page file while running the server.

        This is a Microsoft Windows system administrator's question. My guess is: "no chance". If you reduced the page file size then what would you expect to happen with the data that is lost?
        Windows cannot guess which areas of memory you no longer need, that is up to the programmer (you).

        I don't think you quite understand exactly what the pagefile is. I'd suggest doing some reading (starting with RAM, Virtual Memory, Pagefile and all that stuff and moving on from there if required) before messing around with any of these settings. I've only ever seen the pagefile being purged on reboot (set up via a registry key), the argument for this was to clear out any unencrpyted data which may have been stored there by certain applications.

        Martin

Re: how to refresh Pagefile size in windows 2003 server
by marto (Cardinal) on Sep 16, 2009 at 13:16 UTC

    I agree with cdarke, profile your code using something like Devel::NYTProf first, you may have some optimization work to do within your Perl code. Perhaps if you describe how your app is designed, what it does and any data it uses more advice could be given (posting a cut down version which replicates the issue would help). Failiing that you could install more RAM in your system and leave the OS to manage virtual memory.

    Martin