by Edward Goldstick
When Jim asked me to do this gig, he made it clear that I could touch on controversial issues but that he was principally looking for some techie/geeky/nerdy gossip or rocket science. So while I may get to the former outside of technological settings, here's a meager whiff of both at once in four parts. (Wnd with all the usual formalities that I have no financial interest in any of the companies to which I refer other than an online acquaintance with the creator of #1 as a longstanding user and customer.)
- Does your Mac sometimes seem to run out of memory?
- Help, my Vista-based Compaq laptops and/or our Belkin wireless routers is/are crazy!
- The best* VNC client for MacOS X when connected locally is...
- The best* VNC solution for MacOS X when connected remotely is...
* With a few caveats (and bones thrown to both Apple and Microsoft...
1. Does your Mac sometimes seem to run out of memory?
I've owned a Mac since 2005, but I've been using UNIX full-time since about the thirteenth year in the Unix Epoch (about 1983). I bought myself an iBook/G4 for my 50th birthday on a whim but also because I was fed up with XP and Linux even if each got the job done in its own way.
And while my iBook/G4 is still running strong (though only with MacOS 10.5.x), I also acquired (OK, I won an online contest at MacWorld.) an Intel-based iMac around 2008 and have kept it updated with the latest OS (now Snow Leopard, 10.6.x). I've been very happy with my Macs (other than a hardware problem in the iMac last year that is a long story in its own right), and I and have largely stopped using Windows (other than on other family computers) and only use Ubuntu-flavored Linux on my late dad's machine when at my mother's house.
But here's the thing: All of these machines had shown a strange propensity to gobble up system memory over time. I don't have any exotic apps running -- mainly just browsers, mail, word processing, videos, music, etc. -- so why does memory disappear as reflected in the Activity Monitor even if I close all these apps?
I'm not going to get into the esoterica of virtual memory, MMUs (Memory Management Units), swap space, etc. Nor am I going to sing the praises of vanilla UNIX over Linux over MacOS X over Microsoft products. Nor am I going to tell one of the many headaches that we experienced over fifteen years of running a business helping people build distributed applications that ran 24/7 for 365 days a year (and no, they don't get Feb 29 off). I hope to write about this later in a more conceptual post about software robustness.
Simply put, your machine works in a "virtual" memory space that is bigger (much bigger) than the physical memory made of silicon chips. The electronic data in the CPU has to access data in the physical memory, so when that gets filled (or even gets close to that), your system automatically moves stuff onto pieces of the hard disk called "swap" ... and stuff is moving in and out of swap all the time.
Get it? And for now, here's a trick that readers with Macs might try if they have seen this phenomena and wonder what's up:
Open a terminal and type: echo admin_password | sudo -b -S sh -c "du -sx /"
... and it will all happen happily in background... or,
Open a terminal and type: sudo -b -S sh "du -sx /"
... and you'll just have to type in the password manually... or,
Just open a terminal as the administrator and type: du -sx /
... and wait for the result.
So, what's going on here? Well, the "du" command is for "disk utilization"; when you run it "normally", you get back the number of bytes being used on the device (so in this case, your main disk). The options "-sx" don't really do anything except that the "x" ignores file systems that are mounted to your principal one that is at "/" (you don't need to traverse them) and the "s" is simply to give you a total only for "/", the root of your machine's main system disk.
And so all that's happening is that the "du" process is traversing all your files on your system disk to see how many bytes are actually being used by real files; however, to do this reasonably accurately, it attempts to "clean up" the file space of extraneous "inactive" blocks, though it can only do that if it is run as the administrator.
Now, system mavens might tell you that there is no difference between an "inactive" block of system memory and a "free" block ... but OK, I'm neither going to start a debate nor will I explain the way that fixed sized block of system memory are managed on the disks via a tree of inodes ... well, I'm not going to start.
Don't believe me? Here's what I just did on my iMac (on which I'm writing this...):
A) "Normal" state after about 9 hours w/Apple Mail, Safari, Chrome, Firefox and Textedit:
B) After quitting all these applications:
C) After running "du -sx /":
Yes, I only have 2 GB in this iMac ... and as we say in French, "et alors?" (or "so what?" with a sneer). This problem is classic, it will creep up on you even if you have 8 GB in your machine, it is not specific to MacOS X, though that's what I'm familiar with here and I have not found a better solution yet.