Just "found" why my SSD was missing 28GB

defaultluser

[H]F Junkie
Joined
Jan 14, 2006
Messages
14,398
So yeah, I recently upgraded my gaming computer from 4GB ram to 16GB, and I noticed recently while making space for Titanfall that my previously roomy 160GB SSD was looking very full. I totaled-up the used versus free, and came up NEARLY 30GB SHORT!

Turns out that Windows automatically allocates two files based on how much ram you have: suspend to disk, and page. For me, the swap file used the same size as ram (even if I didn't need it), and the suspend file used 3/4 the size of ram (again, even if you're not using the feature), so my total file size jumped from 6GB to 28GB when I upgraded my ram. That's just not something I can ignore!

If you're on a desktop you can disable the suspend to disk entirely, and you can tell Windows to grow the size of the page file on--demand (assuming you have more than enough ram). I used this guide here and set a range for the page file, but set the minimum to 1024MB so that Windows error reporting would still work:

http://techgage.com/article/disabling_windows_pagefile_hibernation_to_reclaim_ssd_space/
 
250 views and no replies? Damn the SSD forum is a strange place :D

I realize this might be widely-known by the hardcore, but since there's no pinned SSD FAQ or anything, I thought I'd share my expereince. This used up 20% of the free space on my drive, which will ultimately affect write performance!

While I'm at it, does anyone have any other optimization suggestions for my SSD?
 
Try 32 GB ram. You fix that shit fast

Well yeah, when I started out the machine only had 4GB ram, so the page file was lost in the noise of my (then) massive 160gb SSD :D

People with 8GB ram for their systems might not notice, and they're missing 14GB.
 
Seriously? You've been on [H] for 9 years? You sir have disappointed me. :p
 
Seriously? You've been on [H] for 9 years? You sir have disappointed me. :p

It just amazes me that Windows has gone so Steve Urkel on the damn swap file. I remember in Windows 3.1 and 95 that it only used as much disk space as needed, and shrunk the swap file when not in use.

When the hell did Windows decide it was okay to just take a big chunk out of the disk and call it good?
 
When the hell did Windows decide it was okay to just take a big chunk out of the disk and call it good?

It was better for hard drives to allocate the swap in 1 big chunk instead of resizing due to fragmentation.
 
It was better for hard drives to allocate the swap in 1 big chunk instead of resizing due to fragmentation.

...which doesn't affect SSD performance all that much.

So, why the hell doesn't an SSD-aware OS like Windows 7 offer to dynamically resize the swap when you install? It's just wasting critical disk space for no benefit.
 
Fixing this for smallish SSDs is probably is not a high priority item at Microsoft.

I have hibernation enabled on my 1TB 850 pro on a system with 30GB of ram - and I do not worry at all about how much space is used by hibernation / pagefile ...
 
I disabled hibernation in windows and deleted the hibersys file using a linux live usb. I solved the problem your having with the pagefile by moving it to a 2nd disk.
 
I disabled hibernation in windows and deleted the hibersys file using a linux live usb. I solved the problem your having with the pagefile by moving it to a 2nd disk.

why'd you have to use linux? "powercfg /h off" in an elevated command prompt automatically deletes the hibernation file.
 
eh, really why is a page file needed any more at all? So you have 4GB ram and a 4GB page file for 8GB total. Now I have 32GB. Any (non-server) app really exceeding 4GB memory.... would probably indicate some type of problem or failure to organize data properly. which I can believe, considering some games are 40GB disk. Like wtf do they need 40 GB diskspace for? I can store 40 hours of 1080p video content on 40GB, and the game cannot be using all that space for unique textures.
 
FWIW, I'm running 16GB of RAM, have my page file completely off and have never had a program force close on me.

Granted I do nothing more than game, download and do basic video ripping/editing/authoring on my PC, but still.
 
i have 48gb of ram. i disable hibernation, and set the page file to 2048mb.
 
Try a program called Tree Size, it will show you what folders/files are taking up space. Pretty nice way to find old files taking up space.
 
I make sure to turn that hibernate stuff off with "powercfg /hibernate off" as well as the pagefile. Saves like ~20GB every time.

Also, Windirstat is ftw!
 
Delete old system restore points too. Windows will happily eat up to half of your boot drive with that junk unless you set it otherwise.
 
I'll give you an e-cookie if you can tell me how to clear out the WinSxS folder.
 
eh, really why is a page file needed any more at all? So you have 4GB ram and a 4GB page file for 8GB total. Now I have 32GB. Any (non-server) app really exceeding 4GB memory.... would probably indicate some type of problem or failure to organize data properly. which I can believe, considering some games are 40GB disk. Like wtf do they need 40 GB diskspace for? I can store 40 hours of 1080p video content on 40GB, and the game cannot be using all that space for unique textures.

Some poorly coded apps look for page files and wont work otherwise.And then what happens if one day you do go over your Ram usage cause you dont notice something...
 
eh, really why is a page file needed any more at all? So you have 4GB ram and a 4GB page file for 8GB total. Now I have 32GB. Any (non-server) app really exceeding 4GB memory.... would probably indicate some type of problem or failure to organize data properly. which I can believe, considering some games are 40GB disk. Like wtf do they need 40 GB diskspace for? I can store 40 hours of 1080p video content on 40GB, and the game cannot be using all that space for unique textures.

There are quite a few reasons why, I set mine to half my memory.
 
I'll give you an e-cookie if you can tell me how to clear out the WinSxS folder.

The windows built-in Disk Cleanup utility (with the most recent updates) will automatically cleanup the WinSxS folder with "Windows update files" checked.
 
The windows built-in Disk Cleanup utility (with the most recent updates) will automatically cleanup the WinSxS folder with "Windows update files" checked.

Ahh, I'll have to check that out.

Hopefully by cleaning it up it'll knock out 95% of the files in there.
 
eh, really why is a page file needed any more at all?

Efficiency, basically.

Your page file is used for data which was in memory which has been updated and is not needed in memory any more. It is the operating system's decision as to what is 'needed' and what is not. If you don't have a page file, (or swap space, on unix systems) you limit the Operating System's choices of how to behave, and it will therefore behave less efficiently than if it had that room.

That's the general reason, but let's make this a little more concrete by giving a real (albeit contrived) example which might happen.

You have 4GB of memory, you have 4GB of pagefile/swap. You're editing a video, so there's a bit of data in memory of the application and there's a lot of cached data that the OS is keeping for parts of the video that you're not editing right now, but which the system might like to use. 10 minutes ago you were editing some pictures to insert into the video, and the application's open but you're not using it.

A pop up appears to say that you've got mail, so you switch to your mail reader (or your browser if you're using web-based mail - it doesn't matter for the purposes of this discussion). Now the OS is struggling. The data that you had for your picture editing and your video editing, and the cache is taking up all the memory, and the mail reader/browser wants some more. We need space to be able to get your inbox/read the message/present it/whatever... So we look for candidates to free up that space.

There are (in this example) 7 areas of data that we can look at (in reality there are many more than this, but we're keeping it simple). There's is the application code - the picture editor, the video editor and the mailreader/browser. There's the application data in each of those applications, and there's the general OS cache (the OS cache will generally be divided up more than this, but we reduce it to a single pool for simplicities sake).

The OS cache is always discardable - at any time you can toss it away and the system will have to fetch data from the disc. But it will hurt your performance. The application code itself is discardable and can also be obtained from disc. The application data, however, is stuff that's been edited. You cannot discard it - you need to store it somewhere if you're not keeping it in memory. So it's a good candidate to go into the page file. Anything that's transferred into the page file will hurt performance when you need to access it, so you don't do it lightly - only when the only other choice is to fail to allocate memory (which would be bad).

The OS has more information than this though. It knows that your photo editor hasn't been used for ages - and it knows that the application code is obtainable from disc. So it can just throw away the data for the application code, knowing it can reload it (at a small penalty). And it knows that the application data in the photo viewer hasn't been accessed recently, so it could page that out to the page file. It's up to the operating system which is more appropriate. Probably a lot of that data will go out to the page file, AND the application code will be discarded too, because generally something that's not been used for a while doesn't need to be immediately accessible.

The operating system knows that the cache data is useful - it's there because you've been using it and you might use it soon. It means that when you need the data, it's still in memory without needing to go to slow discs (or external resources like network filesystems, etc).

So you have a slight slow down whilst you switch to your mail reader/browser whilst space is made for them, but you deal with the mail. You return to your video editing and you're happy - the cache means that your editing continues without too much impact.

Now, take away the page file from your system.

The operating system no longer has the option of putting your data on to the disc. That data's got to stay in memory, so the candidates left are the application code (which can be reloaded from disc), and the cache data (which can also be reloaded from disc, but is generally of more immediate use). So the OS is forced to discard the memory used by your photoviewer application and parts of your video editor. It's also forced to purge some of the cache for the video you were editing - again, that's ok, it's only there to make things quicker. Essentially you've limited the amount of data it can cache and the possible avenues for freeing up space, and the efficiency of the system begins to suffer.

The time taken to purge this is actually much faster than the time taken to flush data to the page file, because you're just marking a lot of things as unused, rather than actually writing them out. Anyhow, the mailreader/browser is paged in and you get your mail. You switch back to the video editor, and the application code needs to be paged in. Probably not much was paged out because the OS knows you were using it recently. But the cache has gone, and so moving around the video is now a lot slower as the data has to all be obtained from disc. And because the mail reader/browser was used recently the OS doesn't want to evict it from memory yet - and the application data for the browser cannot be written to the page file even when you're not using it, so it too fills up memory, and your cache remains limited, so the performance is impaired.

So that gives you an idea of what's going on. If you want to substitute 'play a quick game of unreal' for receiving an email, you then exacerbate the circumstances a lot more, but the principle remains.

Paging algorithms vary wildly between Operating Systems, and between configurations of those Operating Systems, so the actual behaviour will vary in detail from what I've given as the example. However, the principle is simple - if you remove the page file (or limit it too much) you remove options for the Operating System. It's trying to help you by caching data. It's trying to help you by pushing out data from memory that it doesn't need access to right now in favour of the things you are working on right now.

Obviously there are limits to how much swap/page file you really need, but giving the system an option and ability to move about sensibly is why the page file is needed, even with lots of memory.

If you want an analogy... "Why do I need to have a spare room when all my stuff fits into the rest of the house?", and when your mate breaks up with his girlfriend for the 8th time this month, you are still able to get around the house without tripping over them. Ok, maybe that's not the best analogy, but hopefully something in this ramble has made some sense.
 
yeah, I know that, but that is not really the point. memory swapping was an issue when 4GB or less was the maximum memory available. Today I have 32GB and windows allocated a 32GB swap file on my SSD. Sure, I could do video editing and 'fill' my memory, but for typical apps it is difficult to conceive how that much memory would be filled up to the point where windows "assists" by moving data to swap file. The same probably applies to systems with 8 GB. What windows does do is "churn" by moving data to swap file every so often. Which with so much memory is a useless operation and annoying to hear the drive ticking away.
 
yeah, I know that, but that is not really the point. memory swapping was an issue when 4GB or less was the maximum memory available. Today I have 32GB and windows allocated a 32GB swap file on my SSD. Sure, I could do video editing and 'fill' my memory, but for typical apps it is difficult to conceive how that much memory would be filled up to the point where windows "assists" by moving data to swap file. The same probably applies to systems with 8 GB. What windows does do is "churn" by moving data to swap file every so often. Which with so much memory is a useless operation and annoying to hear the drive ticking away.

But you know what... Windows is an evolution of older systems. Older systems needed that swap file, and Windows has a lot of legacy things carried over from older systems. Could they theoretically put a check where it maxes out the swap size a 4 or 8gb? Yes, they could. But introducing a line of code to a function is not a trivial task, especially if the person that originally wrote that function no longer works with them. For them, the logical business decision would be to simply leave it as is and let the users adjust it however they want to.

I'll have to double check, but I believe my current swap size is set to something like 512 mb. In hours of operation, I have not seen pagefile usage exceed 400 mb. And it only jumps that high while gaming. You are grossly exaggerating how much Windows actually uses the swap file if you have large amounts of RAM, at least based on my experience.
 
16GB system ram = disabled page file.

Been like it for 2 years and had 0 problems with installing / loading / running apps and/or games.
 
For suspend/hibernate the OS needs a place to put data stored in RAM in case the power is removed (power outage, tripped over the power strip, dog chewed the cable, etc.). That file needs to be big enough to store all of the data...yes, potentially 64GB+. In order to ensure the space is available when the OS actually suspends, the space is pre-allocated so that it's not possible to use that space, so you end up with a large hole in your drive of unused space if you don't ever suspend/hibernate.

I'm not sure about Windows, but I know a lot of Linux distributions try to create a SWAP partition that's at least the size of your RAM, so that it can store that data to that partition when you suspend. I usually forgo that, and either make a small partition/swap file or just leave it out altogether. I have 16GB RAM, though (minus ~2GB for the iGPU). :/

Code:
$ free -h
              total        used        free      shared  buff/cache   available
Mem:            13G        1.7G        8.2G         38M        3.7G         11G
Swap:            0B          0B          0B
 
Don't forget to make sure hibernation is disabled by executing powercfg -h off in cmd (run cmd using "Run as Administrator"). If you're using a laptop, most of the time Hibernation will be enabled and that will eat up space equal to the amount of RAM you have.
 
With 48GB of RAM, I have a 2GB manually set page file, min and max. I typically see Windows 7 x64 hovering around 7.5GB of memory used on a given day (pc is on pretty much 24x7), and page file usage of 100MB. Doesn't bother me to have one as long as it's regulated down well enough.
 
So I checked my computer, my pagefile is actually 1gb with typical usage ranging from 50-100 mb with just web browsing and ~400 mb with gaming. 1gb isn't that much space, I see no reason to eliminate it completely and deal with potential issues.

As for hibernation, I set it to be half of my RAM size. Mostly because I use Windows 8.1's hybrid boot feature.
 
why'd you have to use linux? "powercfg /h off" in an elevated command prompt automatically deletes the hibernation file.

ya you dont have too i just do it cuz iam dual booting anyways.
 
When the hell did Windows decide it was okay to just take a big chunk out of the disk and call it good?

Two reasons that go hand-in-hand, mainly:
1. Storage got dirt cheap just before the SSD craze. Large capacity drives for very little cost.
2. Convenience for the user in regards to stable (and faster) hibernate/wake cycles.
 
I don't even both with sleep / hibernate any more. My computer boots in literally 7-9 seconds, so i just turn stuff off when i need it to be off.
 
eh, really why is a page file needed any more at all? So you have 4GB ram and a 4GB page file for 8GB total. Now I have 32GB. Any (non-server) app really exceeding 4GB memory.... would probably indicate some type of problem or failure to organize data properly. which I can believe, considering some games are 40GB disk. Like wtf do they need 40 GB diskspace for? I can store 40 hours of 1080p video content on 40GB, and the game cannot be using all that space for unique textures.

With enough RAM, you almost never need a pagefile. I don't use one and I have 16GB. I went without one with 8GB RAM for a good while, though eventually I added one.

Also, your SSD is certainly not "missing" any space that is used by the OS. I don't know why so many people see it this way. It is an unreasonable expectation to begin with.
 
I disable paging entirely more often than not.
If I do need a pagefile for some piece of software..
I make a RAMdisk and put it on that :D
 
Back
Top