topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday April 23, 2024, 3:59 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: FreshMem  (Read 4826 times)

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
FreshMem
« on: April 13, 2012, 10:42 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

db90h

  • Coding Snacks Author
  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 481
  • Software Engineer
    • View Profile
    • Bitsum - Take control of your PC
    • Read more about this member.
    • Donate to Member
Re: FreshMem
« Reply #1 on: April 13, 2012, 01:08 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 ;). 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 PM by db90h »

db90h

  • Coding Snacks Author
  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 481
  • Software Engineer
    • View Profile
    • Bitsum - Take control of your PC
    • Read more about this member.
    • Donate to Member
Re: FreshMem
« Reply #2 on: April 13, 2012, 01:14 PM »
Here were my summation points, since I write terrible:

<ul>
<li>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).</li>
<li>RAM is the fastest storage medium you have. The more data in it, the better.</li>
<li>Forcing virtual memory to be paged out causes it to be paged back in again when it is referenced.</li>
<li>Seldom referenced virtual memory is automatically paged out by the virtual memory manager as needed.</li>
<li>Defragmentation of RAM is absurd, as there is no seek time.</li>
<li>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.</li>
<li>There is no 'leftover junk' from terminated processes, as the virtual memory space of a process is completely cleaned up once it terminates.</li>
<li>In Vista+, <a href="http://en.wikipedia....hnologies#SuperFetch">SuperFetch</a> 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?</li>
</ul>

<b>Other rules to live by</b>
<ul>
<li>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)</li>
<li>Is your disk/file cache so big that surely it doesn't help to page more applications out? If so, you're good.</li>
<li>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.</li>
<li>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).</li>
<li>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.</p>
</ul>
« Last Edit: April 13, 2012, 02:03 PM by db90h »

db90h

  • Coding Snacks Author
  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 481
  • Software Engineer
    • View Profile
    • Bitsum - Take control of your PC
    • Read more about this member.
    • Donate to Member
Re: FreshMem
« Reply #3 on: April 13, 2012, 02:05 PM »
Ok, final edits made ;). Now, back to doing my taxes

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: FreshMem
« Reply #4 on: April 13, 2012, 07:30 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.

db90h

  • Coding Snacks Author
  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 481
  • Software Engineer
    • View Profile
    • Bitsum - Take control of your PC
    • Read more about this member.
    • Donate to Member
Re: FreshMem
« Reply #5 on: April 14, 2012, 09:04 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.