Question about Vista and RAM use

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

Post Reply
User avatar
Pablo Sanchez
Commissar
Posts: 6998
Joined: 2002-07-03 05:41pm
Location: The Wasteland

Question about Vista and RAM use

Post by Pablo Sanchez »

I bought a new computer a while ago and it came with Vista, which I've gotten used to, but there is an issue which I'd like to have clarified by somebody who knows such things. One of the standard desktop "gadgets" is a meter which shows the current usage of CPU and RAM. Immediately after I turn the computer on and the startup process finishes, the percentage of RAM in use while the computer is "idle" (that is, not running any intensive program) usually stays around 24% or so, but the longer I leave the computer running the higher this climbs, to a maximum of like 36-38%. I googled this and apparently there are processes in Vista that account for this kind of thing, but I'm just wondering whether this is a concern and could actually affect performance. Subjectively, resource-intensive games like Far Cry 2 seem to run noticeable better right after I boot the computer, when RAM usage at idle is lower. Is this actually the case?
Image
"I am gravely disappointed. Again you have made me unleash my dogs of war."
--The Lord Humungus
User avatar
Xon
Sith Acolyte
Posts: 6206
Joined: 2002-07-16 06:12am
Location: Western Australia

Re: Question about Vista and RAM use

Post by Xon »

Vista pre-loads applications & data you commonly use at a given time into memory.

Open task manager and select the performance tab, this is much better information than simply looking at the percentage of physical memory used.

For example; my computer is reading "6540 MB" cached and 6 MB free with a physical memory usage of 31% (I have 8gb of ram). Ideally, the Free value should be as close to zero as posible, that means the OS is caching as much as it can. Cached memory can be reclaimed effectively instantly if actually needed.

Really you only need to worry when the physical memory usage starts hitting +90% and you start getting thrashing when doing things often.
"Okay, I'll have the truth with a side order of clarity." ~ Dr. Daniel Jackson.
"Reality has a well-known liberal bias." ~ Stephen Colbert
"One Drive, One Partition, the One True Path" ~ ars technica forums - warrens - on hhd partitioning schemes.
User avatar
Resinence
Jedi Knight
Posts: 847
Joined: 2006-05-06 08:00am
Location: Australia

Re: Question about Vista and RAM use

Post by Resinence »

Even better, you can use the "resource monitor" that they introduced in Vista, it will show you what and where the memory is going, how much of it is cache and how much of it is shared.
“Most people are other people. Their thoughts are someone else's opinions, their lives a mimicry, their passions a quotation.” - Oscar Wilde.
User avatar
Stark
Emperor's Hand
Posts: 36169
Joined: 2002-07-03 09:56pm
Location: Brisbane, Australia

Re: Question about Vista and RAM use

Post by Stark »

This is just one of those legacy things; people got used to 'reducing memory usage' and 'omg memory usage is bad', when in Vista it's actually a good thing (more or less).
User avatar
Ryan Thunder
Village Idiot
Posts: 4139
Joined: 2007-09-16 07:53pm
Location: Canada

Re: Question about Vista and RAM use

Post by Ryan Thunder »

My guess is that its garbage collection, which doesn't try to reduce memory useage until more is needed.
SDN Worlds 5: Sanctum
User avatar
Steel
Jedi Master
Posts: 1123
Joined: 2005-12-09 03:49pm
Location: Cambridge

Re: Question about Vista and RAM use

Post by Steel »

Ryan Thunder wrote:My guess is that its garbage collection, which doesn't try to reduce memory useage until more is needed.
No, I think as others have said that as the OS can instantly clear out anything it has cached it preloads anything it thinks you might need so that things load faster. If you end up not opening anything it picked then its no slower, but if it did get something right then it'll load faster.

I was a bit annoyed when I first saw vista that it seemed to be hogging so much of my ram, but the fact is that its actually using it rather than just wasting it sitting idle is an improvement.
Apparently nobody can see you without a signature.
User avatar
Dominus Atheos
Sith Marauder
Posts: 3904
Joined: 2005-09-15 09:41pm
Location: Portland, Oregon

Re: Question about Vista and RAM use

Post by Dominus Atheos »

Empty RAM is wasted RAM. If you have 4GBs and the computer is only using 2GBs, you might as well not have payed for 4GBs.
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Question about Vista and RAM use

Post by phongn »

Ryan Thunder wrote:My guess is that its garbage collection, which doesn't try to reduce memory useage until more is needed.
What does GC have to do with anything?
User avatar
Pablo Sanchez
Commissar
Posts: 6998
Joined: 2002-07-03 05:41pm
Location: The Wasteland

Re: Question about Vista and RAM use

Post by Pablo Sanchez »

Dominus Atheos wrote:Empty RAM is wasted RAM. If you have 4GBs and the computer is only using 2GBs, you might as well not have payed for 4GBs.
Yeah, because the most RAM intensive thing I run is my desktop.
Image
"I am gravely disappointed. Again you have made me unleash my dogs of war."
--The Lord Humungus
User avatar
Ryan Thunder
Village Idiot
Posts: 4139
Joined: 2007-09-16 07:53pm
Location: Canada

Re: Question about Vista and RAM use

Post by Ryan Thunder »

phongn wrote:
Ryan Thunder wrote:My guess is that its garbage collection, which doesn't try to reduce memory useage until more is needed.
What does GC have to do with anything?
Instead of disposing of unused memory as soon as it was no longer needed, garbage collection does not dispose of any used memory at all until more is needed for whatever the program is trying to do. This is important to consider when you're looking at how much RAM is presently being used, because you could almost fill it with things that aren't actually being used at the moment and then have a bunch of it clear out all of a sudden because it needed a few megabytes more for something else.
SDN Worlds 5: Sanctum
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Re: Question about Vista and RAM use

Post by phongn »

Ryan Thunder wrote:Instead of disposing of unused memory as soon as it was no longer needed, garbage collection does not dispose of any used memory at all until more is needed for whatever the program is trying to do. This is important to consider when you're looking at how much RAM is presently being used, because you could almost fill it with things that aren't actually being used at the moment and then have a bunch of it clear out all of a sudden because it needed a few megabytes more for something else.
Operating systems (in general) do not garbage collect.
Pablo Sanchez wrote:
Dominus Atheos wrote:Empty RAM is wasted RAM. If you have 4GBs and the computer is only using 2GBs, you might as well not have payed for 4GBs.
Yeah, because the most RAM intensive thing I run is my desktop.
I can't tell if you're being sarcastic or not - but DA is quite right here. An OS should be using all of the RAM it can at any instant (generally for cache) and then the moment you want to run something else, it'll overwrite said cache with the software you're actually using.
User avatar
Ryan Thunder
Village Idiot
Posts: 4139
Joined: 2007-09-16 07:53pm
Location: Canada

Re: Question about Vista and RAM use

Post by Ryan Thunder »

phongn wrote:Operating systems (in general) do not garbage collect.
Oh? I didn't know that.

Even so, I wasn't thinking of the OS so much as whatever he had running in it.
SDN Worlds 5: Sanctum
User avatar
Pablo Sanchez
Commissar
Posts: 6998
Joined: 2002-07-03 05:41pm
Location: The Wasteland

Re: Question about Vista and RAM use

Post by Pablo Sanchez »

phongn wrote:I can't tell if you're being sarcastic or not - but DA is quite right here. An OS should be using all of the RAM it can at any instant (generally for cache) and then the moment you want to run something else, it'll overwrite said cache with the software you're actually using.
So if I regularly run something (like gaming) that uses a lot of RAM, then Vista is caching that as well, and still ending up with less than 40% used. So I do have a large amount of excess RAM. The computer I bought came with six gigs of RAM, which I suppose really is excessive for gaming and will be for a couple years to come, but the other person who uses the computer likes to play around with video editing, so I thought it might be useful for that, if not for what I use it for.
Image
"I am gravely disappointed. Again you have made me unleash my dogs of war."
--The Lord Humungus
User avatar
Starglider
Miles Dyson
Posts: 8709
Joined: 2007-04-05 09:44pm
Location: Isle of Dogs
Contact:

Re: Question about Vista and RAM use

Post by Starglider »

Ryan Thunder wrote:
phongn wrote:Operating systems (in general) do not garbage collect.
Oh? I didn't know that.
Even so, I wasn't thinking of the OS so much as whatever he had running in it.
Garbage collection does not work like that; except for in a few exotic research OSes, it's layered on top of normal memory management. When it starts up a program requests a certain amount of memory from the OS, say 100 megabytes. Initially this space is unused, but it still shows up as 'used' in your memory meter, because it's been reserved for the use of that specific program. As the program loads and creates data, the space is filled up. When the program needs more memory but there is nothing left in its already allocated block, it requests another chunk (say another 50 megabytes) from the OS. In runtime systems that use garbage collection, a GC pass is made right before asking for more memory from the OS, to try and free up some more space in the program's currently allocated memory and avoid requesting more.

I'd note that your premise is incorrect anyway, because basically all GC systems make regular GC passes even when there is plenty of heap space remaining. This is to avoid stalling the program with a huge burst of GC activity when the memory runs out, and in some systems (e.g. the Sun Java VM) to optimise memory layout for higher performance.

Non-GC sytems suffer from at least as much if not more wasted space due to fragmentation and the fact that without active compaction it's difficult to return space to the OS except in the case of specially allocated buffers. There's no way to know how much of the memory a program is shown as using is actually using without breaking out (language-specific) profiling tools.
Post Reply