Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running Windows Vista Home Premium SP2 32-bit.

Is it true to say that once I quit a process (Task Manager > Processes tab), the RAM used is immediately reclaimed?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Yes. The memory pages are re-assigned into the Free pool, where they can be allocated to new processes on demand. A very-low priority process in the OS will eventually zero out those pages, adding them to the Zeroed pool. You can watch this going on with Process Explorer (though they get zeroed out fast enough it's hard to see).

Pages of memory in either of these pools are free for the taking for existing or new processes. Once there are no free pages in either the Free or Zeroed pools, the OS will start to forceably page out memory from other processes to re-use pages of physical RAM as needed. There are 2 sets withing this group: Standby and Modified pages. A Standby page is one that has alread been paged out to the page file and can be re-assigned to a different process (or within the same) quickly. A Modified page has a dirty flag set and needs to be saved to the page file before it can be re-assigned.

share|improve this answer
    
if the RAM is reclaimed, why is it that first opening a program (eg IE or Opera or FireFox etc) it usually takes some time but after I've closed it and waited 10 minutes, and open it again it is much much faster compared to the first time? –  Pacerier Jul 31 '11 at 23:02
    
Even though the physical RAM is freed up, most modern operating systems are smart about caching files often used, or used together. These files might be left in the page file or some other structure for easier load time. For example, you'll see a bigger benefit when the OS can pre-determine that it will need, say, 5 files at once (a.exe, b,dll, c.dll), instead of relying on the normal behavior (page faults) to load them on demand. The information will still need to be paged from disk to RAM, but will be better optimized to frontload necessary files and to avoid seeking around the hard disk. –  Jimmy Jul 31 '11 at 23:53
    
ok thanks cool =D –  Pacerier Aug 1 '11 at 10:31
    
Jimmy, can you show where in Process Explorer? –  barlop Aug 28 '11 at 22:04
    
@barlop: In the System Information window, which can be reached by clicking on any of the performance graphs (CPU/RAM/IO) or from the View menu. –  Jimmy Aug 28 '11 at 23:50

I depends what RAM you mean. If you mean any RAM containing data modified by the process, then yes. Those values could never, ever be used again. So the RAM must be marked free.

If you mean RAM containing portions of the executable file, no, that RAM is not reclaimed. It was already marked discardable, since the system can always read the data back from disk if needed anyway. Freeing the RAM immediately would suck for two reasons:

1) It's a completely wasted effort. If the computer makes the RAM free and it isn't needed soon, the effort of making it free gained nothing. If the computer makes the RAM free and it is needed soon, the effort of making it free just forces the system to make it used again, resulting in doubled effort. (The system could just have left it discardable and switched it to another use without ever making it free.)

2) It deprives the system of the opportunity to use that data again. If the same program runs again, having the data already in RAM saves disk I/O.

share|improve this answer
    
in the Task Manager (i'm windows vista) there is a place that show us the "Memory". Does this memory coincides with the first RAM that you were talking about or the second RAM that you were talking about? –  Pacerier Aug 29 '11 at 7:02
    
There are actually several "memory" fields in the task manager, but they don't correspond to either of these because while the program is running, there isn't a difference. (And generally, file data resident isn't cache isn't accounted for by process anyway. Consider if 8 copies of a program are running. Do you charge the executable to all of them?) –  David Schwartz Aug 29 '11 at 12:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.