Welcome Guest.   Make a donation to an author on the site October 21, 2014, 08:43:11 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2011! Download 30+ custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: FreshMem  (Read 1572 times)
c.gingerich
Supporting Member
**
Posts: 491



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« on: April 13, 2012, 10:42:10 AM »

This is an app that I made a while ago but decided to fix it up and post it here. It is an app that optimizes the memory use of all running applications. I used to have a slow system with little RAM so I made this to release all un-needed memory so my system would work better. Now I have a fast system with loads of RAM, but I like to use fun stuff (mainly Stardock apps like DeskScapes, WindowBlinds etc). Also, browsers take a good bit of memory also and I do tech support and programming from home so I have a lot of apps running at the same time. It sits in the system tray and releases memory every "n" amount of time, default is set to 15min, but I have it run every 15 seconds and it works nicely. Please take a look and let me know what you think. It is a free app. Website -> http://bit.ly/HuRayE
Logged

db90h
Coding Snacks Author
Charter Member
***
Posts: 455


Software Engineer

View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: April 13, 2012, 01:08:09 PM »

Of course that screenshot changes the moment you switch back to that Chrome instance (tab) and begin using it ... as most of that paged out virtual memory is reloaded into RAM.

In contrast, the virtual memory manager will automatically page out seldom referenced pages of memory as needed. It keeps track of what pages of memory are referenced, and tries to keep your RAM full of stuff that is referenced often, and pages out stuff not referenced if RAM is needed for something else (or for use as the disk/file cache.. which is what your 'free' RAM is used for).

For a thorough and in-depth analysis of this type of operation (clearing the working set of all processes), the penalties involved, and potential (unlikely) benefits in some situations, you can read this page: http://bitsum.com/winmemboost.htm ..

There are a gazillion other tools to do this too.. I even threw it in Process Lasso as an always free feature (to periodically trim virtual memory, or trim on demand, or on trigger), because so many people wanted it, despite my hesitance to add such a feature.

I believe CleanMem is the most popular these days.

As for trimming all active process memory every 15 seconds ... WELL, if that makes you feel better, whatever works, BUT I'm glad you didn't default to that Wink. That would force continual hard page faults (a page fault is when memory is paged in from the page file because it is not already in RAM, not a crash .. though, yes, there are some types of crashes also called page faults).
« Last Edit: April 13, 2012, 02:06:22 PM by db90h » Logged
db90h
Coding Snacks Author
Charter Member
***
Posts: 455


Software Engineer

View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: April 13, 2012, 01:14:36 PM »

Here were my summation points, since I write terrible:


  • Virtual memory is a powerful abstraction layer. Many people think of virtual memory as only that memory that is paged out. NO, all memory is virtual memory, whether it is in RAM or the page file (or swap partition).

  • RAM is the fastest storage medium you have. The more data in it, the better.

  • Forcing virtual memory to be paged out causes it to be paged back in again when it is referenced.

  • Seldom referenced virtual memory is automatically paged out by the virtual memory manager as needed.

  • Defragmentation of RAM is absurd, as there is no seek time.

  • Defragmentation of RAM can not help you if your 32-bit application is out of a contiguous virtual memory address space large enough for its needed allocation.

  • There is no 'leftover junk' from terminated processes, as the virtual memory space of a process is completely cleaned up once it terminates.

  • In Vista+, SuperFetch tries to keep the most commonly used 'stuff' in RAM, based on your behavior. It is essentially a 'smart cache'.. and it does a surprisingly good job. Are you sure you want to force it outta RAM?



Other rules to live by

  • Is your RAM NOT completely and fully utilized already? If not, you're good. (see the Windows Resource Monitor, or subtract the 'cached' RAM from the 'free' RAM in the Windows Task Manager)

  • Is your disk/file cache so big that surely it doesn't help to page more applications out? If so, you're good.

  • In some cases, you may see a benefit if you page out applications you *know* you won't be accessing for a while, or that have memory leaks. However, you may eventually pay a penalty for this if they are referenced again.

  • HOWEVER, if it works for YOU - then go for it. PCs are incredibly complex software environments, so if you do see a difference by doing this -- have at it.
    Whatever works for YOU. I like to call the combination of software, hardware, and user behavior the 'executive environment'. Each one is different, thus perhaps
    in some cases these tools do offer some aid, and perhaps penalties later paid are insignificant. Just make sure the tool at least does it *right*.
    What is *right*? Right is using the appropriate Windows API to force a page out of a process, not doing something insane like allocating all available memory to force
    everything else out (which I've actually seen some do ;o).

  • I've always been critical, and you should be too. However, check the above criteria, and determine for yourself if it really makes a difference.



« Last Edit: April 13, 2012, 02:03:07 PM by db90h » Logged
db90h
Coding Snacks Author
Charter Member
***
Posts: 455


Software Engineer

View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: April 13, 2012, 02:05:52 PM »

Ok, final edits made Wink. Now, back to doing my taxes
Logged
c.gingerich
Supporting Member
**
Posts: 491



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: April 13, 2012, 07:30:35 PM »

Wow, Thanks for the info. I never really looked that much into memory stuff. It worked for me when I had a slow system, so I used it. Never released it so, I guess only use it if you think it may help.
Logged

db90h
Coding Snacks Author
Charter Member
***
Posts: 455


Software Engineer

View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: April 14, 2012, 09:04:42 AM »

I do not mean to be disparaging. Indeed virtual memory management is more complex than I've even laid out here, and is often misunderstood by developers and end users.

I would like to add one thing, a 'visual' screenshot of the Windows Resource Monitor's 'Memory' tab. Notice it shows 'Hard Faults/sec' as an important metric. That is because it represents, as I tried to write above (like I said, I write terrible), that ideally the fewer hard page faults your system incurs, the better. These are page-in operations. If you run your tool every 15 seconds, you should see this metric shoot up as a bunch of pages are pulled back into memory as they are referenced. The *only* thing that may mitigate it some is that a few page faults (page-in operations) may be in the active disk cache, and thus be a soft page fault. These are not shown here (though you can see them elsewhere).

How does this mechanism even work? Well, it's actually pretty cool ...

1. A page of virtual memory not already in RAM is accessed by a process ..
2. BOOM -- a page fault is generated
3. This page fault triggers the virtual memory manager to get that page into memory
4. The access to the virtual memory continues

That is how processes can run without the virtual memory manager needing to know before-hand what virtual memory *must* remain in RAM and what can stay paged out. Like I said, the virtual memory manager then keeps a 'reference count' for each page of virtual memory and *tries* to tune the system so that commonly referenced virtual memory is kept in RAM, and seldom referenced virtual memory gets paged out.







* win_res_mon_hard_faults.PNG (54.46 KB, 727x533 - viewed 88 times.)
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.039s | Server load: 0.18 ]