Jump to content

Adjust virtual memory?


Recommended Posts


I created a setpagefile.vbs file that I call from my unattended install. I can also run the script from my autorun interface.

Dim strComputer, objWMIService, objSWbemServices, colPageFile, colSWbemObjectSet
Dim objSWbemObject, SystemRAM, objPageFile
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer)
Set colPageFile = objWMIService.ExecQuery ("SELECT * FROM Win32_PageFileSetting")
Set colSWbemObjectSet = objSWbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
For Each objSWbemObject In colSWbemObjectSet
    SystemRAM = objSWbemObject.TotalPhysicalMemory / 1000
Next
For Each objPageFile In colPageFile
 objPageFile.InitialSize = 1.5 * SystemRAM
 objPageFile.MaximumSize = 1.5 * SystemRAM
 objPageFile.Put_
Next

You can change the values, this is that basic script that sets the page file to 1.5 times ram and sets the min and max size the same to make a static swapfile.

Link to comment
Share on other sites

  • 1 month later...
I created a setpagefile.vbs file that I call from my unattended install. I can also run the script from my autorun interface.

<code here>

You can change the values, this is that basic script that sets the page file to 1.5 times ram and sets the min and max size the same to make a static swapfile.

Wow, this really works!! Thanks!

Link to comment
Share on other sites

[...]to make a static swapfile.
Sorry to nitpick, but Windows does not use a swapfile, and has not since before Windows 95. Although we generally use the terms "swapfile" and "paging file" interchangeably, they are slightly different. Swapfiles swap entire processes from RAM to the file, while paging files only move small parts of programs from RAM to the paging file at a time.

Secondly, the old "1.5x" rule for RAM and paging files was always a poor rule. The more RAM you have, generally the smaller paging file you need; the paging file is meant as a poor substitute for the sytem memory. You should choose the size of the paging file based on how much virtual memory is needed when your system is under it's heaviest load. For this reason, I never set the paging file for someone else like you're doing (and if this is for your computer only, then you shouldn't need to calculate the size based on system memory at all). I always give them the option of size, or if you know what kind of usage the computer gets set the paging file at that limit.

Link to comment
Share on other sites

Hiya,

I always use a static pagefile, I've got a gig of memory and rarely need much more...anyway, here's the regfile I apply from CMDLINES.TXT at T-12:

Windows Registry Editor Version 5.00

;set pagefile to 256MB
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"PagingFiles"=hex(7):43,00,3a,00,5c,00,70,00,61,00,67,00,65,00,66,00,69,00,6c,\
 00,65,00,2e,00,73,00,79,00,73,00,20,00,32,00,35,00,36,00,20,00,32,00,35,00,\
 36,00,00,00,00,00

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...