Filed under: Software
iFreeMem 2.0: when you just don't feel like rebooting
As good as OS X memory management may be, if you run your system for long periods of time without shutting down you'll likely see an increasing number of spinning beach balls as your uptime counter ticks away. When applications quit – especially big, memory-hungry applications – they often leave your RAM fragmented and unavailable to subsequently launched apps. The solution is generally a reboot, but if you're looking for something a little friendlier and less time-consuming, iFreeMem is a superb solution. The utility was just updated to version 2.0 with full Leopard support.
I'm a long-time user of iFreeMem. On my MacBook Pro with 3 GB of RAM, it can generally clear up about 800 MB (sometimes more) after I quit a long session in apps like Photoshop and Motion. And it's rescued me on numerous occasions where I've found myself with three or four MB free and everything starts slowing to a crawl. I just loaded version 2 and it's faster and more efficient than ever. Good stuff.
The author has signed up with Trial-Pay, which I can't say improves the image of the app or increases my respect for it, but it does provide one option to get a $19 application for free. In light of the overall positive nature of this post, I won't delve into my opinions on Trial-Pay and its ilk. Suffice to say that I'm a happy customer of iFreeMem who paid full price and have never regretted it. Oh, and the 2.0 upgrade is free for users of previous versions, you just have to re-enter your registration code. You saved it, right?
Get a feel for whether or not iFreeMem would save some reboots for you with a 15-day, fully functioning trial.

![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 2)
Daveed V. said 10:38AM on 2-21-2008
Fragmented RAM? On an OS with paged virtual memory?
I suspect all it does it remove memory-mapped scratch files. If so, you could achieve the same with "sudo periodic daily" and/or "sudo periodic weekly".
Reply
valgonzarp said 10:43AM on 2-21-2008
Voodoo. Memory fragmentation is not an issue on modern operating systems with paged virtual memory.
Reply
ryan said 10:44AM on 2-21-2008
Maybe it's just me, but I've never noticed this problem and I regularly go more than a month without restarting. OS X actually does this weekly, I believe. You should be able to get about the same effects using:
Terminal > sudo periodic weekly
Also, many (all?) memory optimization apps create 'free space' by emptying the cached information that applications keep in memory to increase performance. Removing them actually causes running programs to perform more poorly as they have to repopulate memory with all of the cached data that you removed in order to 'optimize' your system. You will, however, be able to launch another application more quickly because you have already cleared out the cache that would have needed to be cleared out to make room for the new application. However, it should take at most the same amount of time to let OS X clear out some of the cache as it would take to let the memory 'optimization' app clear out all the caches. In short, you and your wallet are probably better off just letting OS X handle its own memory usage.
Keep in mind that when your OS uses a lot of RAM, that's almost never a bad thing. OS X in particular runs best when there is a large amount of 'Inactive' memory (all the cached stuff). You shouldn't be on a crusade to see the amount of 'Free' memory be as high as possible.
Reply
Jon said 10:50AM on 2-21-2008
Don't use this or any other similar garbage utility. Pure snakeoil.
As a computer engineer, I can assure you free memory is wasted memory. The Darwin/Mach developer teams know their stuff and have used PHD research in designing *the best* memory paging system available in the world for the darwin kernel. Like any modern OS, memory pages not actively used is paged to disk. The physical memory is now available for disk caching and temporary information.
If that doesn't prove anything, think about his logically. Could some 2bit snakeoil vendor really develop research on something that an entire crew of open source developers backed by a multimillion dollar company?
This developers target audience is the same that buy the ionized bracelets improve your mood or something.
Reply
Zak said 11:38AM on 2-21-2008
Jon is completely right. There's no need for this application. You *want* OS X to use all of your memory. If it doesn't, the memory is being wasted. This isn't OS 9, you're not going to have issues if you have "three or four MB free". OS X keeps as much of everything you do in memory as possible, and if you need more it will simply release memory from another application that isn't being used.
Isn't that the whole point of dynamic memory allocation? All this application will do is make your apps load slower because it's forcing OS X to dump all its stored memory. Everything you do after that point will need to be reloaded from disk instead of from memory, because you just dumped it all.
By using this app you are literally preventing OS X from managing your memory efficiently. Snake oil is as good a description for it as any. And this is also why Apple suggests that with OS X, you put your computers to sleep rather than shutting them down every time you're done using them - so it can keep everything loaded in memory to allow your Mac to work faster.
I mean come on, think about it! If there's 800 MB of RAM being used after a long session in Photoshop and Motion, why would you dump that? Next time you go into Photoshop it has to start over again! It would be a much better idea to simply let OS X manage your memory, and next time you go into Photoshop or Motion, that memory allocated to those apps will be there waiting and the app will run faster because it doesn't have to load everything from disk all over again. If the system needs more memory it will take it from an inactive app and reallocate it.
Nathan Hand said 2:28AM on 2-22-2008
Yes, Darwin uses a paged memory model. Yes, it's best if the kernel uses all the memory for buffers and caches rather than leave pages unused. But despite comments above, there's no such thing as "the best" memory model.
Memory is allocated in 4kb pages. However sometimes a process (typically kernel) will require contiguous pages. After running for a while it's possible to have no contiguous pages left in memory. The kernel then needs to shuffle the pages around to get the contiguous pages, which of course takes time. The algorithm to determine how to shuffle, when to shuffle, or whether to keep memory contiguous at all times, is a design decision with *no correct answer*.
Darwin (like most UNIX-like systems, and yes I consider Mach to be UNIX-like) makes use of unallocated memory for buffer cache. That's an efficient use of memory and explains why you typically have 3-4MB free on a system. When an application needs pages, the buffer cache can be quickly disposed of to free pages. However the algorithm to decide what to cache, what to throw away, and the speed with which the kernel disposes of buffer cache (related to memory pressure) is extremely complex. It's basically a guess based on predictive models, and there is *no correct answer*.
Darwin (like most UNIX-like systems) will use the virtual memory system to overallocate physical memory. This is because the kernel expects that applications often ask for more memory than they actually need, and they'll never try to collect. Sometimes they do try to collect and the kernel experiences an Out Of Memory condition. Solaris solves the problem by ensuring there is always enough swap to page out the overallocation. Linux solves the problem by killing one of the overallocated applications (seemingly at random, although the algorithm is improved these days). Some kernels simply prevent overallocation in the first place. Despite personal (and often strongly held) opinions, there is *no correct answer*.
So there is always room for tweaking the memory model. The Darwin programmers cannot have designed the best memory model for every situation - it's a nonsensical statement - and you have more knowledge of your own usage habits. You can make better decisions than some generic code.
All that said, it's very unlikely that this application achieves any of this. Effective memory system tweaking requires direct access to the kernel, and possibly a rewrite of large swathes of kernel code, and it's extremely difficult to achieve for even the best programmers.
kody Willnauer said 11:12AM on 2-21-2008
Here's a free version: Reboot.
20 bucks for something a power button can do? No thank you. Perhaps if it were 5 maybe 9.99...
Reply
ryan said 10:55AM on 2-21-2008
Have you ever noticed that after restarting your computer you have lots of free memory, but that's when your applications load slowest? I routinely avoid restarting in order to avoid this situation, but this application is designed to create it.
Reply
Galley said 11:04AM on 2-21-2008
I will often have 50 or more tabs open in Safari. Once a day I close Safari and it frees up several hundred MB of RAM.
Reply
rdas7 said 4:02PM on 2-21-2008
So even if this did work, you could make a widget to call the terminal command for free :/ Considering apps that actually do something, like Transmit or VisualHub cost about $20, this is a total ripoff!!
Reply
Radek said 12:18PM on 2-21-2008
Hi,
I think there is problem with memory fragmentation in applications as you can see here http://blog.pavlov.net/2007/11/10/memory-fragmentation/
from one of firefox developers.
Reply
Brett Terpstra said 12:19PM on 2-21-2008
Point duly taken. I'm no computer engineer, and voodoo this may be, but I'm going by actual performance gains that I can easily quantify. When I leave Photoshop and the RAM doesn't free up, launching another memory intensive app does, on some occasions, make my system crawl. I have run the daily script previously in these situations, and just tested it again, and it does not in fact achieve the same results. But... as an amend for any disinformation I may have purveyed, I will go and research every point brought up here and wrap my head around what's really going on in my RAM.
Reply
Daveed V. said 12:33PM on 2-21-2008
Radek: That is within-application memory fragmentation. Memory in MacOS (and other modem desktop/server OSs) is allocated in pages (typically of 4KB each). On a machine under fairly heavy use, many of those pages are temporarily stored on disk (swap space, aka. scratch space). When your app has allocated lots of those pages, but only touches a few bytes in each page, the OS may end up writing to/reading from swap much more than necessary. That's what your linked page is about.
However, when the app quits, all pages are returned to the system.
Brett: It is true that in somewhat uncommon circumstances you gain some responsiveness by proactively reclaiming pages. It sounds like you have reliably identified circumstances where it helps you. However, you don't need to buy an app to achieve that. And more often than not, it decreases responsiveness. (Did you also run "sudo periodic weekly" also, or just the "daily" variant?)
Reply
Brett Terpstra said 12:47PM on 2-21-2008
Manually, just the daily variant. I'll run both and see what results I can get. If it can do what this app does, I'll happily hand my license off to someone less convinced that all these computer engineers know what they're talking about :).
Steve said 1:04PM on 2-21-2008
Ah, so the memory "recovery" programs have run out of gullible Windows users to sell their products to and they've moved on to gullible Mac users.
I say this with love. I used to use one of these on Windows as well, before I realized it did nothing, other than sometimes crash my computer.
Reply
Chris Combs said 2:05PM on 2-21-2008
Snake oil.
Reply
Mo said 1:50PM on 2-21-2008
I'd take a wild guess that this app does something not dissimilar the following:
void
free_up_memory()
{
int c;
char *p, *q;
for(c = 0; c < 2048; c++)
{
if(!(p = malloc(1024 * 1024)))
{
return;
}
for(q = p; q < p + (1024 * 1024); q += 4096)
{
*q = 1;
}
}
}
…in other words, it allocates as much memory as it can and makes sure it gets "dirty", forcing everything else to get swapped out. Then it frees it all up again.
The effect is that all your latent caches for applications you're not actually running any more get thrown away, but also all of the memory used by applications which *are* running get swapped out to disk and needs to be pulled back in again.
Really, Darwin's VM could do with a doing a better job of releasing now-unused blocks of virtual memory and gradually swapping things back in which are still running but have been swapped out to make room for the now-dead stuff—I often find it can take a while before the actual amount of “free” memory I have matches what it really should be, and have chunks of VM swapped out that would be more useful swapped back in. In real terms, though, it's a minor quibble, and unlikely to be one that's worth $19 unless you have some sort of psychosomatic condition triggered by Activity Monitor's pie charts.
Reply
thej said 4:06PM on 2-21-2008
If your system is constantly being bagged everytime you launch another app, then spend your money on RAM not cheezy apps like this.
Reply
David Tyler said 4:09PM on 2-21-2008
There is definitely something that causes my Macs to slow to a crawl after a few days uptime, and kernel_task's memory allocation to approach infinity. I'm going to test iFreeMem along with the weekly script to see if either has any real effect.
Reply
Ian said 5:44PM on 2-21-2008
Mark Russinovich's great article from a 5 years back went into great details why these things are genuine snake oil even for the PC, let alone Darwin:
http://www.windowsitpro.com/articles/index.cfm?articleid=41095&cpage=97
free reprint: http://license.icopyright.net/user/viewFreeUse.act?fuid=NzgyNzU0
However, just like homeopathy, placebo is powerful medicine, and if it works to make you feel better, let the placebo rule!
Reply