Is there a way to choose which applications go to virtual memory?

1

1

The way I understand virtual memory is that when an application is not being used for a period of time, the memory being used gets written to disk. When I use an application (netbeans), it seems to be very slow when I go back to it after about ten minutes of doing something else, say, web browsing.

My question is firstly whether I am right about virtual memory and if so secondly, is there is a way to specify whether a certain memory maintains its RAM for a longer time more than others? Or do I have to buy more RAM? I am using Windows 8.1 64-bit

(Or download more RAM) (JOKE)

Cobbles

Posted 2014-05-28T10:16:44.360

Reputation: 113

Agree with @Ramhound. One mistake (probably you meant this) - Virtual Memory and page file are managed by Windows.

– Jet – 2014-06-22T20:36:29.133

@Ramhound: the pagefile is not the only place that the contents of virtual memory can be paged to disk. There are three types of virtual memory in Windows: Nonpageable, private, and mapped. Nonpageable VM is in RAM at all times (and yes, it's still called "virtual", partly because "address translation" still happens). Private VM is backed by the pagefile - or if you don't have one, it has to stay in RAM at all times too. For mapped VM, the file spec'd for each mapping serves as that mapping's backing store (this is how "code files", exe's and dll's, are handled... among other things). – Jamie Hanrahan – 2014-10-04T17:19:08.547

This quite depends on the operating system... – user1686 – 2014-05-28T10:26:58.763

I have added the OS – Cobbles – 2014-05-28T10:27:46.717

You are indeed correct. Virtual Memory is handled by the page file. This allows Windows to tell any application they have access to all your physical memory. Unless you are getting low virtual memory warnings you don't have a memory problem. Use a program to determine how much memory Netbeans is actualyl using, if I were to hazard to guess, it won't be using a great deal which means its unlikely ever being moved into virtual memory – Ramhound – 2014-05-28T11:18:34.950

Answers

0

There is no way to do what you're trying to do within stock Windows. Windows will automatically allow programs experiencing high page fault rates to use more RAM, and will shrink others, if RAM is scarce.

It is possible that a utility program exists that could monitor the RAM assigned to various processes and attempt to dissuade some of them from being paged, by using e.g. the VirtualLock and SetProcessWorkingSetSize APIs on them.

However there are enough limitations with this that it would not do much if any good. A major one is that VirtualLock is done by address range and such a program would have no way of "knowing" which ranges of addresses in the target process were important to be locked. (You can't just lock everything; there isn't room.) These APIs are mostly meant to be used by a process on itself, or among a set of cooperating (and co-knowledgeable) processes, not to adjust random other processes.

(n.b.: VirtualLock can be done cross-process by calling it from a thread created in the target process via CreateRemoteThread.)

Jamie Hanrahan

Posted 2014-05-28T10:16:44.360

Reputation: 19 777