Hey, hey people. It's me again. This time with some sort of a RAM issue. Just to preempt, I've done: Windows memory tool scan, SFC, chkdsk and most other relevant things. I have NOT done Memtest though. If I were to do it, which one do you recommend? 64? 86? 86+? And this is the issue:
Sometimes when I play Unity games(Battlesector, Solasta), the game crashes with the Unity error window being visible shortly and the Windows Event Viewer says that the following happened:
"Resource-Exhaustion-Detector
Windows successfully diagnosed a low virtual memory condition. The following programs consumed the most virtual memory: AAAAAAA.exe consumed aaaaaaaa bytes, XXXXXX.exe consumed xxxxxxxxx bytes, and YYYY.exe consumed yyyyyyyyyy bytes."
What's up with that? It only started happening recently ... oh there is one more thing you should know about:
When I manually sum up the RAM usage, it comes to the different number than the one that the computer reports. Can something be running in the background, in the invisible mode, idk? And about the cached RAM that takes up huge amount of space ... is that normal?
///
Thank you for your assistance!
Comments
The message should list three processes that consume most memory.
Most likely your hardware and Windows are ok, but AAAAA.exe has memory leak or other problem that causes it to consume all your memory.
Does the game feel notably sluggish after a while? That can mean that you're running out of memory and could benefit from adding more physical memory to your system. Buying more memory to combat a game's memory leaks is not ideal, but you can't fix the memory leaks in someone else's game.
What's going on? And why does it show more RAM usage than it's shown by the visible processes?
If you bring up the task manager you will see a lot of processes. I have 98 background processes running Windows. Only 5 apps, and they use about 500mb total (no games). Still 40% of 32G is used.
------------
2024: 47 years on the Net.
Yeah, but they usually take up ~30-40% of those 16 GBs. If I add another 50%(8 GB) from Battlesector(or something else), there is still breathing room. That's why this interests me. Why would virtual memory be exhausted if I have another 20% RAM on hand(~2 GB)?
What does the memory info on Task Manager look like?
You'll get memory info if from task manager you select Performance, then select Memory. It should look something like this:
In Use and Available tells you the physical memory consumption.
Below those committed tells you total memory consumption, including RAM data stored on page file on your hard drive. The first number is how much memory is committed, and the second number is how much can be committed.
Below those the Paged Pool and Non-paged Pool tell about Window's kernel's memory usage. Those numbers should be relatively low.
What are the numbers for Committed, Paged Pool and Non-paged pool?
It would be best if you check them once when you've just started playing, then second time after you've played for a while to see if something is causing one of them to constantly increase during gameplay.
The available that you've written (huh?) after looks like it should: In Use + Available should tell the total physical RAM on your computer, and based on that it's 4,1 GB + 11,7 GB, which would equal to 15,8 GB.
The usable physical memory is always a bit smaller than actual memory size. So if you've got 16 GB of RAM, and In Use + Available is total of 15,8 GB, that looks like it should.
If your computer is already at 60% usage when it wakes up, I'd restart it. By default Windows 11 never performs full shutdown and boot-up process unless you manually select Restart from the power menu. Making it do the full process could give you smaller RAM usage at start-up. Then try other stuff only if restarting doesn't help.
If you want another way to look at memory usage besides task manager, you can try Resource Monitor. Assuming that you're using Win 11, just write Resource Monitor to the search box and Windows should find it for you. Though I don't know if you can really see everything that's using memory and get those numbers correctly with that either, Window's memory management is complicated and I've never tried to get the numbers add up like that.
But with all that said, could you look at those memory stats while you're running the game that causes crashes. Preferably look once when you've just started playing, then second time after you've played for a while to check whether those numbers change a lot during gameplay.
It would be ideal to look at memory usage right before the game crashes, but since that's often hard to achieve, the aim is to at least look with same programs running as you've got when they crash.
EDIT: Also question, do you have free space on your Windows installation drive? Based on those Committed -values your Windows is using only about 600 MB page file. Windows should automatically increase the page file size when your physical RAM gets too full, but it needs to have free hard disk space to do so. Which means if the hard disk Windows is installed on is completely full of stuff, that could be causing your memory exhaustion errors.
There are two different ways that memory gets divided here that are relevant. One is the difference between physical memory and cached memory. The latter is space on your disk that the operating system can treat as memory, though it's really slow to access, even with an SSD.
The other is the difference between memory allocated and memory actually used. It is common for programs to allocate a bunch of memory and then not use it, or at least, not use all of it. Task Manager only shows you the amount of memory that a program is actually using, and not what it has allocated but is not using.
To see the latter, you'll have to open up Resource Monitor. At least in Windows 10, you can go to the Performance tab, then click the "Open Resource Monitor" link at the bottom. The Memory tab will show you separate columns for "Working Set" (memory actually in use) and Commit (memory allocated but not used), among other things.
The problem is that the total amount of memory allocated (used plus not used, or in the above terminology, "Working Set" plus "Commit") has to be less than the total amount of memory available, as physical memory plus cached memory. If you run out, then when a program tries to allocate more memory, the allocation will fail, as Windows will say, I don't have anywhere to put it. And if a memory allocation fails, then the best that a program can do is to give a useful error message and shut down cleanly.
So why are you running out? One possibility is that you're using a ridiculous amount of virtual memory. It looks like no particular program is doing anything all that egregious. It is common for games to use a lot, as when they try to allocate memory on a GPU, the video driver will commonly claim that same amount as host memory. It is theoretically possible to have a very large number of programs all using a moderate amount of virtual memory, and cause trouble that way, but it's pretty unlikely to happen by accident.
Another possibility is that Windows would like to claim more disk space as cached memory, but can't. By default, Windows will automatically adjust your maximum amount of cached memory and increase it as needed up to a pretty large limit. There are two things that can prevent this. One is if you've changed settings to tell it that it isn't allowed to do so. The other is if you're running out of disk space so that there isn't more space on your hard drive (or I hope, SSD) to claim as cached memory.
Check your SSD or whatever Windows is installed to see how much free space you have. A general guideline is that you want to allow Windows to claim at least 1.5 times your amount of physical DRAM as cached memory. If your drive is nearly full, then it can't do that and may be liable to run out.
After writing most of this post, I see that Vrika has said much of the same stuff. Oh well. I'll post it anyway.
Regardless, what are your suggestions? Most notably about that disparity in memory usage. That's a thing that really interests me. Why does that happen?
Suppose that a programmer needs to have a list of numbers for some reason, but doesn't know how many numbers are going to be on the list. Maybe it's a list of players in one zone of a game, which is constantly changing as players move around.
You have to allocate enough space for all of the numbers that will be in the list. If you try to write an extra number past the end of the list, then something bad will happen, such as the program crashing. You could, in principle, allocate just enough for what you need, and then if you need space for one more, reallocate space for a slightly larger list and then copy over the previous list. This can get really slow, however, as it could mean doing about a trillion copy operations to create a list of only a million numbers.
Sometimes a programmer will say, here, I'll just estimate high and allocate what I'm certain is more space than I'll actually need. If I think that I'll need about 2-3 MB of space and will probably never need more than 4 MB, then I'll allocate 8 MB and be pretty sure that I'll never run out. If nothing gets written to memory past the first 3 MB, then Windows will figure out that the other 5 MB is unused.
That's pretty sloppy, but a better approach is to use the container classes that a lot of programming languages offer. For example, you could have a std::vector in C++, an ArrayList in Java, and so forth. The idea there is that when you create the list, it will start by allocating a small amount of memory, and give you a function to append something to the end of the list. Every time you append something, it will check to see if it has enough space. If so, then it just appends the number at the end of the list. If not, then it will automatically allocate space for a new list that is double the size of the old, copy the old data to the new list, and then free the memory for the old list.
Doubling the size every time you have to reallocate more memory means a lot less copying data around. The number of copy operations can be at most the amount of memory allocated for the list. And it doesn't waste as much memory as if you just estimated way too high and left it at that. But it often still wastes a lot of memory, as if you're just a little past the threshold to reallocate a larger buffer, nearly half of your array is unused memory.
And that's for a good programming practice where the programmer isn't just being sloppy. If you're using some off the shelf game engine that you don't understand very well, the game engine may be automatically reserving a bunch of memory for things that the programmer will never use and doesn't realize that it's even there. Tools that call other tools that call other tools that call other tools often end up being wasteful in convoluted ways.
My question was: "why does task mngr(and the like) report more RAM usage than it's actually visible?".
-OS needs some background stuff that is not part of any process to function
-Unused memory doesn't benefit anything, so the OS is designed to use extra RAM for stuff like keeping some files from hard disk in RAM for easy access. I don't know how all this extra is calculated in task manager, since the OS is designed to free a lot of that for other purposes if the computer runs low on physical memory
For long answer, I think you can find more info with tool like RAMMap
https://techcommunity.microsoft.com/t5/ask-the-performance-team/introduction-to-the-new-sysinternals-tool-rammap/ba-p/374717
Does that count as memory in use? It depends on which total you look at. Windows Vista made it count toward the most visible memory total, which confused a lot of people. That's why subsequent versions of Windows made it not count toward the most visible total, though I'm sure that it's still displayed somewhere if you look for it.
Similarly, does memory that has been allocated but not yet used count as memory in use? It again depends on which total you look at.
As for what changed, a lot of things could have changed. Maybe you play a game now that uses more memory than others that you've played in the past. Maybe you like to have more things running in the background than you used to. Maybe you have malware running in the background and using a bunch of memory. Maybe a program that you've used for a long time updated and the new version uses a lot more memory than the old. I don't know what changed, but unless it's one huge thing, it will probably be impractical to track down.
Control Panel
-> Hardware and Sound
-> Change What The Power Buttons Do (under Power Options)
From there you'll find checkbox for "Turn on fast start-up". You'll need to click "Change settings that are currently unavailable" before you're able to change it.
If fast start-up is turned on the computer shuts down all programs and then places the OS to hibernation when you shut the computer down. When fast start-up is turned off, the OS shuts all programs and then itself when you shut down.
Settings
-> System
-> About (it's located on the bottom of the list)
-> Advanced System Settings
-> Performance Settings (you need to click button labeled "Settings" inside the "Performance" -box. There are three buttons labeled "Settings" on that same screen, be careful to pick the one inside correct box)
-> Advanced (from the tab selection menu at top)
From there you find the button to change virtual memory. If you have right now very small page file and 60 GB free disk space, you might want to check whether doing something like setting the page file temporarily to 40000MB (about 40 GB) would fix your problem. Just remember to revert that setting after checking to free up the used hard disk space.
Though I still think it'd be a good idea to check what the committed, paged pool and non-paged pool look like when running the game before trying any fixes.
I think that the clearest example of this being useful is web browsers using a different process for each browser tab. That way, if some rogue web site causes something to crash, it doesn't kill the browser entirely. Rather, you can just close the offending tab, while the rest of your browser tabs are fine.
I don't know what exactly Steam was doing. One possibility is that it was updating some game in the background, since the computer was largely idle. That could temporarily use a lot of memory, which is what you observed.