unused ram is a good thing

her34

Senior member
Dec 4, 2004
581
1
81
since vista there has been a belief that: all unused ram=wasted ram. that's not true

superfetch is nice but some unused ram is necessary for 'breathing room'. vista will fill your ram to the brim and this isn't the best approach.

let's look at an example. say superfetch is pre-caching 20 programs for you. now you open a regularly used program like an internet browser. once you start browsing a couple different websites the browser will need more ram. to make space for the browser vista will delete some superfetch cache, say for programs 19 & 20. once you close the browser free ram is created so vista will fill up that ram with cache for programs 19 & 20.

and this happens over and over. start using one program a lot like a office program or browser, or editor, and superfetch cache will get cycled in and out. the worst culprit is a game because the cycling in and out happens during gameplay which affects performance.

the big question to ask is: how many times will cache for programs 19 & 20 be cycled in and out vs how many times will a user actually open that program and make use of that cache?

the more ram you have the worse this is because then we're talking about programs 29 & 30 or 39 & 40 which are even less likely to be used.


but i suppose if hdd activity doesn't bother you then you like superfetch the way it is...

 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
since vista there has been a belief that: all unused ram=wasted ram. that's not true

This thought came around WAY before Vista...

Chances are, if the RAM isn't used for superfetch or whatever, it's used for FS cache. Unused RAM is wasted ram. It's hardware you paid for that you aren't using. Screw that.
 

nullpointerus

Golden Member
Apr 17, 2003
1,326
0
0
Originally posted by: her34
since vista there has been a belief that: all unused ram=wasted ram. that's not true

superfetch is nice but some unused ram is necessary for 'breathing room'. vista will fill your ram to the brim and this isn't the best approach.

let's look at an example. say superfetch is pre-caching 20 programs for you. now you open a regularly used program like an internet browser. once you start browsing a couple different websites the browser will need more ram. to make space for the browser vista will delete some superfetch cache, say for programs 19 & 20. once you close the browser free ram is created so vista will fill up that ram with cache for programs 19 & 20.

and this happens over and over. start using one program a lot like a office program or browser, or editor, and superfetch cache will get cycled in and out. the worst culprit is a game because the cycling in and out happens during gameplay which affects performance.

the big question to ask is: how many times will cache for programs 19 & 20 be cycled in and out vs how many times will a user actually open that program and make use of that cache?

the more ram you have the worse this is because then we're talking about programs 29 & 30 or 39 & 40 which are even less likely to be used.

The problem is that you don't seem to be accounting for the relative speeds of the operations, which is what SuperFetch exploits. Cycling out memory pages is orders of magnitude faster than cycling them in because all that's needed to free up physical memory used as cache* is to mark some indexes as being free. That's a nearly instantaneous process compared to cycling in, which loads things from a far slower physical device (i.e. the HDD).

* The stuff in SuperFetch's cache is by definition already on the HDD, so there's no need to write it back to the disk. All that's needed to "free" the memory is to mark the indexes as unused so that they can be overwritten as needed.

but i suppose if hdd activity doesn't bother you then you like superfetch the way it is...

I wouldn't recommend using Vista with less than 1.5 GB of system memory. I use 4 GB myself and find SuperFetch greatly improves my load times with no apparent ill effects. The time difference between replacing 1 GB of SuperFetch and filling up 1 GB of free RAM is on the order of milliseconds--hardly noticable, IMO. But Vista simply won't work well when multitasking with 1 GB of total memory: there'll be lots of HDD thrashing and large games like Oblivion will take ages to unload.
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
the big question to ask is: how many times will cache for programs 19 & 20 be cycled in and out vs how many times will a user actually open that program and make use of that cache? the more ram you have the worse this is because then we're talking about programs 29 & 30 or 39 & 40 which are even less likely to be used.

I don't think you really understand the concept of 'caching'. If there was something better to cache with the memory, Windows should cache that instead. But there's never any really good reason to have "free" or "empty" RAM. DRAM is so much faster than a hard disk that it only has to be right occasionally to make up for the amount of 'wasted' time that the hard drive spends reading.

but i suppose if hdd activity doesn't bother you then you like superfetch the way it is...

Unless Windows is consistently fetching stuff that you'll never ever use, you have to load the data from your hard drive at some point. You might as well do it in advance. If you go for weeks without loading apps 39 and 40, Superfetch should be smart enough to stop bringing those in, and maybe bring in a bigger piece of some other app, or some files that you have been using more recently.

Now, you could argue that over very very long time periods, repeatedly prefetching data that is not likely to be needed will put some extra wear on the hard drive that it wouldn't otherwise have. However, this should be very minor compared to the amount of stuff the hard drive has to load anyway, and IMO you're not going to dramatically decrease the lifespan of the drive unless you are pushing it really hard for many hours per day. Spending an extra 10 seconds reading data once an hour is not going to kill the disk appreciably faster.
 

StopSign

Senior member
Dec 15, 2006
986
0
0
I use Vista on my laptop with 1 GB of memory and it's fine. I don't see any hard drive thrashing. But then again, I'm not really running any memory-intensive stuff on my laptop that requires memory to be swapped back and forth by SuperFetch.
 

her34

Senior member
Dec 4, 2004
581
1
81
Originally posted by: nullpointerus

The problem is that you don't seem to be accounting for the relative speeds of the operations, which is what SuperFetch exploits. Cycling out memory pages is orders of magnitude faster than cycling them in because all that's needed to free up physical memory used as cache* is to mark some indexes as being free. That's a nearly instantaneous process compared to cycling in, which loads things from a far slower physical device (i.e. the HDD).


i am taking into account the speeds. yes clearing the superfetch cache is a trivial delete. i'm not implying the data gets transferred back out from ram to hdd.

the point i'm making is if it's worth it to keep cycling infrequently used data in & out of ram to make space for a program you are using. it would be better to just leave 100-200mb free for breating room
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
the point i'm making is if it's worth it to keep cycling infrequently used data in & out of ram to make space for a program you are using. it would be better to just leave 100-200mb free for breating room

Why?

It only fetches with idle CPU/HD time, so it's not slowing other things down.

If you happen to use the data it fetched, it's a significant increase in performance. If Windows decides later that it needs that RAM for something else -- it costs practically nothing.

There's no reason to not prefetch as much data as possible if you think it has a chance of being used soon. The only way that you could justify not filling all your unused RAM with cache would be if you somehow knew that you would actually be using that RAM very soon (so that the data would just end up being discarded). If I am running some program or set of programs with relatively constant RAM usage -- I want all the remaining RAM to be used to cache stuff from disk, since the HDD is so much slower than everything else in the system. Keeping hundreds of megs of 'free' RAM in a case like that is just dumb.

If you were running some program that allocated and freed large amounts of memory very quickly -- yeah, you might cause Superfetch to thrash back and forth to disk a whole lot for no good reason. I don't know if it has some mechanisms in place to prevent this, or if this will even occur often enough in practice to be concerned about.
 

her34

Senior member
Dec 4, 2004
581
1
81
Originally posted by: Matthias99

I don't think you really understand the concept of 'caching'. If there was something better to cache with the memory, Windows should cache that instead. But there's never any really good reason to have "free" or "empty" RAM. DRAM is so much faster than a hard disk that it only has to be right occasionally to make up for the amount of 'wasted' time that the hard drive spends reading.


i don't think you understand my point. the purpose of free ram would be to leave space for an app you're using. vista will leave 0 mb free.

take a common task most everyone does like internet browsing. you open a few pages, your browser needs 10mb ram, so superfetch cache gets deleted, and refilled later. this happens every time. this happens often.

it would be better to just leave ~100mb free. especially if you have 2gb of ram. the difference between 1.5gb of superfetch cache and 1.6gb of superfetch cache is trivial, but 100mb free ram would reduce hdd activity a lot.

Unless Windows is consistently fetching stuff that you'll never ever use, you have to load the data from your hard drive at some point. You might as well do it in advance. If you go for weeks without loading apps 39 and 40, Superfetch should be smart enough to stop bringing those in, and maybe bring in a bigger piece of some other app, or some files that you have been using more recently.

whatever new app becomes 39 & 40 are by definition in those slots because they are used so infrequently.

yes the data for an app has to at some point be loaded. but is it worth preloading this data X number of times per day every day for that one time you actually load the app, to save a few seconds?

 

SexyK

Golden Member
Jul 30, 2001
1,343
4
76
Originally posted by: her34
Originally posted by: nullpointerus

The problem is that you don't seem to be accounting for the relative speeds of the operations, which is what SuperFetch exploits. Cycling out memory pages is orders of magnitude faster than cycling them in because all that's needed to free up physical memory used as cache* is to mark some indexes as being free. That's a nearly instantaneous process compared to cycling in, which loads things from a far slower physical device (i.e. the HDD).


i am taking into account the speeds. yes clearing the superfetch cache is a trivial delete. i'm not implying the data gets transferred back out from ram to hdd.

the point i'm making is if it's worth it to keep cycling infrequently used data in & out of ram to make space for a program you are using. it would be better to just leave 100-200mb free for breating room

Your logic isn't really making much sense here - I'm not understanding how it's "better" to leave breathing room. You said yourself that flushing cached data is a nearly instantaneous action, so why would you choose to wait for programs "19 and 20" to load from the hard drive rather incur that .0001ms penalty when you need free RAM for another process? You must use programs 19 and 20 sometime, or else they wouldn't be cached (or installed?) at all.
 

grant2

Golden Member
May 23, 2001
1,165
23
81
I think Her34 feels it's simply inelegant to pre-cache programs 19/20 since they are so likely to be discarded.

From a performance standpoint, of course it's fastest to completely fill the cache.
 

nerp

Diamond Member
Dec 31, 2005
9,865
105
106
Vista doesn't "completley" fill up your RAM either. The fact of the matter is that Vista works wonders with superfetch and it is FAR more desirable to have unsed memory be used for caching purposes than to simply be empty. The "clearing out" process that must take place in order to clear needed cached memory is so quick that the adage "unused memory is wasted memory" is completley and totally true.

There simply is no argument in favor of having loads of free memory available.
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
Originally posted by: her34
i don't think you understand my point. the purpose of free ram would be to leave space for an app you're using. vista will leave 0 mb free.

take a common task most everyone does like internet browsing. you open a few pages, your browser needs 10mb ram, so superfetch cache gets deleted, and refilled later. this happens every time. this happens often.

it would be better to just leave ~100mb free. especially if you have 2gb of ram. the difference between 1.5gb of superfetch cache and 1.6gb of superfetch cache is trivial, but 100mb free ram would reduce hdd activity a lot.

So? Your HDD works a little harder every now and then. It doesn't have anything better to do.

I could see -- maybe -- tracking recent memory usage and not immediately recaching things from disk if you were very frequently discarding entries from cache in the recent past. Like I said, if you have some reason to believe that your 'free' memory will not be free for very long, pulling in data from disk is a waste of time. But if your active programs' memory usage isn't bouncing all over the place -- you want all the RAM to be used as disk cache for those programs, and/or to cache other programs or files you may want to use soon. Keeping 'empty' RAM around in this case can only hurt performance.

Whatever new app becomes 39 & 40 are by definition in those slots because they are used so infrequently.

If you're not using what it is caching, it will cache something else that you are using.

Now, if you have, say, 1GB of stuff on disk that you use 99.9999% of the time, but 4GB of RAM? Yeah, there will be stuff in the Superfetch cache (or any disk cache) that hardly ever gets used. If you were running programs that spent all their time allocating and deallocating huge amounts of memory, you would do a lot of reading in from disk for very little gain. But this is hardly a realistic scenario for most users.

The only way other way I could see this kind of tradeoff potentially being worth it is if the disk would be totally idle other than the Superfetch activity. In this case, being able to keep the disk spun down a much much higher percentage of the time might be worth having a little bit less data cached.

yes the data for an app has to at some point be loaded. but is it worth preloading this data X number of times per day every day for that one time you actually load the app, to save a few seconds?

Until X gets really big, yes. It's still better than leaving the RAM "empty" in terms of performance. And if you're really going for days or weeks without loading this program -- if your other programs are doing practically anything on the hard drive, you'll end up caching their data from disk instead of infrequently-used executables.
 

archcommus

Diamond Member
Sep 14, 2003
8,115
0
76
At what point exactly did people start realizing that unused memory is wasted memory? I too used to be under the impression that I should keep everything closed to keep RAM free. Then I started changing my mind as I read others' opinions and realized that I really liked keeping frequently used things open, like my TV program, Outlook, etc. But I sure remember back in the day people liked having as much free RAM as possible while doing normal desktop tasks. When did this mindset change?

I know some of you will say "I always knew this," what I mean is, when did this idea spread to the common people of AT.
 

grant2

Golden Member
May 23, 2001
1,165
23
81
Originally posted by: Matthias99
The only way other way I could see this kind of tradeoff potentially being worth it is if the disk would be totally idle other than the Superfetch activity. In this case, being able to keep the disk spun down a much much higher percentage of the time might be worth having a little bit less data cached.
Hard drives don't stop spinning while the computer is on (except for power management options). And there is no other reason for it to stop spinning.

While the hard drive is idle, it's spinning with the head at a rest position.



 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
Originally posted by: grant2
Hard drives don't stop spinning while the computer is on (except for power management options). And there is no other reason for it to stop spinning.

...that's what I was talking about? :confused:

Let's say you have a program that's running and not using the disk at all, but it's allocating and deallocating large amounts of memory. This will make Windows kick a lot of cached data out of memory during the allocation process, and it will later on try to bring that cached data back into memory after the program deallocates it (since that memory is now 'empty'). But if the program is just going to allocate more memory very shortly, you're keeping the disk busy for no good reason.

If there's nothing else using the hard drive (so you could spin it down), that might be a reason to not bring the cached data back into RAM right away. This would lower power usage (a bit), reduce the amount of noise the system makes, and save some wear on the drive's motor. But if the drive is going to be powered up, there's not a whole lot of reason to not start filling the free memory back in.