But I just gave you a link to MSDN... Still, I'll ask again, can YOU provide me with a source that tells me, as a C++ developer, never to use shared memory in Windows? I'm still waiting, because it's going to be a very controversial material that I (and thousands of Windows developers) would love to discuss.
You have yet to provide a link and I searched MSDN with no success for what you're describing.
Now this is a very bold statement, mister. Are you a certified Windows developer? Or maybe you have a source that tells why such practice shouldn't be used? Mine says that it's perfectly fine, and it is Microsoft Developer Network.
And I assure you that it does. I explicitly state in my code the fact that I need my file mapping object to be put into the page file, and if I don't check for the ability of doing such thing at some point, your copy of application will crash, guaranteedly. Now, I don't have to completely rewrite this part of my product because some technical enthusiasts (like you) believe in possibility of achieving "speedup" because they turned something off in their Windows. I want my 0.7 GiB of in-memory infrastructure to be preserved in a specific area on your system drive and not in the RAM, for obvious reasons (and that's why this whole page file thing was created in the first place). You've got 16 GiB of RAM? Excellent! Not everybody does, though. Most of budget laptops (as well as old systems) come with only 2 GiB, then there are tablet devices, virtual machines and thin clients.
I like this term, "modern software".
Again, can you please tell me what are you trying to achieve by disabling page file? I just don't understand, I really don't. Swapping is a completely transparent mechanism that helps to prevent your RAM from over-bloating by data that your Task Manager thinks won't be needed on a high demand. You allow this thing to eat up as much processor time as it wants, purge your drive's cache, but when it comes to storing 30 MiB of changes history from your Microsoft Word... You just don't let it to! Why?..
There is no link in that entire post.
I'm not, but I'm using Win32 API capabilities, as millions of people around the planet do. It's a pretty straight-forward stuff, really. If this looks like "writing an OS" to you, then I don't know why are you even trying to call me and many other people incompetent developers.
I'm calling you incompetent for how you're using it. Not for using it in the first place.
Then tell me the right one. Where do I store my file mapping object on Windows? I need the exact copy of a specific area of memory that will be handled entirely by the OS (restricted read access, automated disposing), what's your solution?
In active memory. If you start running out, let Windows swap pages for you. Windows keeps track of the most commonly used pages and swaps out the least used one. Don't try to presume you can do a better job than the OS can.
What are you talking about?.. Page file is not being separated or mirrored in RAID setups, it's placed on one drive. You can double check that with specific tools (for example, Dell provides one for their servers customers).
If you store a page file on a RAID drive, you are storing it on the entire RAID. For someone like me who has only RAID devices available in Windows, that's not feasible.
True. Those 0.03% of lifespan wasted over the course of 5 years mean a lot. Oh, but what if there's an update for your browser? What if it burns some of your precious little blocks?.. Come on, MSI installers can eat up something like 10 MiB during their work just to save all the log files and registry changes. Your Battlenet cache for Battlefield 4 will require something like 50 MiB when you get a new rank and a few ribbons just to display them on your screen...
None of that stuff is stored in swap unless you have it enabled and you've run out of memory. That's my point. MSI installers and Battle.Net definitely don't require a page file.
You don't know what you're talking about. Windows, like any other OS will not allow you to just dump a direct copy of memory onto drive, it violates the encapsulation principle and exposes said data (which might be sensitive) to possible threats. And so you have a specific Win32 API call to tell the OS parameters such as buffer size, destination size and so on. If at any point your code fails to predict the size of second parameter (or the unexpected changes occur), this opens up a possibility of denial-of-service attack. If user terminates your app, again, said data won't be purged and will remain on your drive forever, open to all sorts of threats. Shared memory mechanism does check all this for you the fastest and most secure way possible, because it's already implemented by Windows creators.
This only re-emphsizes my point that you probably achieved what you wanted to with sub-optimal tools and the wrong way. I still don't understand why you need to use the page file directly and not just store shared data in memory. You can bash me all you want and call me names, but when push comes to shove, you're using the page file wrong.
Do you want to review my code? I'm open-minded towards this sort of stuff, if you are a fellow developer willing to help me to understand Windows memory management better, then why not.
I can look at it, I can't say how much time I'll have to look at it. I guess I would be more interested in exactly what you need to use swap space for and where you do it. Without seeing it, I can only guess what you're doing. Are you writing this in VC++ or a different CLR language? I just don't recall ever needing to do anything with the swap file, even with shared memory. Granted, I did Windows development several years ago but this sounds like something that hasn't changed for a decade though.
As a total newbie and mostly a user that is concerned about HDD space, what would be the minimum amount of page file the would be wise to keep. I have 8 GiBs of ram and never, on idle, exceed 2 Gigs. I once or twice exceeded 4.
You do seem to know your stuff and, until aquinus forks out some sources, I'll have to turn to you for questions.
That's insulting considering I'm speaking from my education and my degree in Comp Sci and he has yet to provide a source either. It's simple really with how swap works. Swap moves unused data in memory to the disk to leave more open to whatever you're doing and swaps them back in if the machine needs them.
Swap space:
Benefit: You can use more memory than you have.
Your machine won't crash when you run out of physical memory.
There will be place to dump system debug logs.
Disadvantages: Increase disk I/O (and increases as you reach your memory limit.)
Due to I/O wait, the overall system will slow down. (Thrashing)
If you use enough swap space, you could make the machine unresponsive.
No swap space:
Benefit: Pages never leave active memory unless they're being free'd up.
Windows will stay in memory (I find minimizing/maximizing in and out of games to be faster with it disabled but that could be placebo effect.)
No page file will exists, which means you won't have a xGB file sitting on your disk.
SSDs don't like swap.* I'll explain this.
Disavantages:
You can't swap out other applications if you run out of physical memory. In other words, the OS will start killing processes to free up space.
Requires enough memory to hold your entire workload plus Windows.
High memory consumption for Windows. (3.5Gb, full load on boot but it never grows bigger.)
*: Now, the SSD bit. Your right that it's not a ton of writes, but keep in mind that memory pages are very small. Writing one Flash page on an SSD might write 16K pages, several times, where the flash drive might need to erase an entire page to write that data. That along is wasteful which is why it's never good to do this to an SSD as it results in write amplification.
What the page file is, most definitely not in dispute. How it's used in certain situations is what we're debating. Most people will want to leave it on, but there are reasons for turning it off.