Quarter Life Crisis

The world according to Sven-S. Porst

« NooooMainFinder Duplicates »

Memory

1125 words on

What I’ve never quite understood in Mac OS X is memory usage. You can make tools print out numbers for you but in the end they remain a mystic bunch of numbers to me. No more and no less. The problem is not only that there is more than one number per application but also that each of those numbers needs interpretation. And all that is before people start woffling about disk caches and other niceties which can clutter your precious memory. I am still looking for a description of application memory usage that I can understand and that will let me judge application’s memory usage.

But let’s take a trip down the memory lane first. Back in the 1980s when we used computers like the C-64 or the Atari ST memory was scarce and precious and I’d bet that the machines as well as their operating systems weren’t particularly helpful at managing memory. But still memory never was an issue (well, to be honest I can remember that a friend had a word processor which required him not to start his Commodore 128 in C-64 mode and that my dad a special ‘BigTeX’ version of TeX which couldn’t run on a 1MB machine, but those look like obscure special cases). Applications were simply made to run in the existing memory.

Happy Mac screenshot

Moving on to the Mac’s System 7, things had become more complicated. As you could run more than a single application at the same time, each application had to make sure it can get an appropriate share of the available memory. On the Mac the solution for that was simple – every application just told the machine its minimal and preferred memory allocation and received just that. Sure, this scheme wasn’t the most flexible one, but as far as I am concerned it worked fairly well.

And most notably, all it took to tell how much memory each application used was to open the About this Macintosh window which gave numbers for each application – both the amount of memory available for the application and the fraction of that allocation actually in use. Simple and easy to understand.

I think with later versions of the Classic Mac OS things became a bit more complicated as concepts as shared parts of memory arose and applications could request some of that while they were running… and this way the total memory used by an application could even change while that application was running. This was particularly noticeable in modern applications like the OpenDoc based Cyberdog.

Comparison of Graphic Converter running both natively in OS X and in its Classic version

And then Mac OS X came. And our ability to judge the memory requirements of each application was diminished. The About this Mac menu item would only reveal the total amount of memory available to the whole system and if you wanted to know more a trip to the Activity Monitor utility or Mac OS X’s somewhat crippled top command line utility became necessary.

But instead of giving us the information we are interested in, these tools give us more information. A choice of five memory related numbers. Apparently an application uses ‘physical’, ‘virtual’, ‘shared’, ‘private’ and ‘private virtual’ memories. And for any attempt to quote one of these numbers to claim that an application does or doesn’t use a lot of memory, I’m sure you’ll find some geek to tell you how stupid you are to do just that. And then you’ll ask said person to explain what the numbers mean and which one is significant and they’ll start mumbling sentences starting with ‘everbody knows’ but somehow fail to exactly pinpoint what each of these numbers mean and how those different memory types add up, intersect or whatever.

In addition it remains unclear what kind of additional resources are included in those numbers. GraphicConverter is an application that even in its latest version is available for the Classic Mac OS as well (up to a few new features). Thus in a way I would have expected the application’s memory usage in both its Classic and its native OS X version to be somewhat similar – possibly even giving me a hint which of OS X’s numbers might be the one I know from the Classic days. But instead I saw the application use 2,3 of its 15 megabytes of memory in Classic and 20 / 160 / 8 megabytes of physical / virtual / private memory in OS X.

So OS X is a colossal waste of memory or the ways of measuring memory usage differ significantly. I saw somewhat similarly strange things when comparing memory usage of PowerPC native vs Rosetta vs Intel native applications. I would have expected both of the native ones to be roughly the same. But that expectation wasn’t met either.

So I’m as puzzled as before – and all that without even mentioning the horrible topic of memory caches. Which is the topic aforementioned Unix geeks will fall back to once they can’t explain what’s going on: The computer is so ‘clever’ that it caches all sorts of things to be faster in the future. That may be true and even make sense in some cases (your second run of TeX will be faster than the first, just as your second Spotlight search will be).

But in other cases it just sucks. And infuriatingly so. Let’s say I’m using the Dashboard once a day to see the weather report. Now guess whether I want to see the weather report right now or whether I’d rather prefer to wait for ten seconds until the computer managed to page in all the relevant junk and jerkily fade in the Dashboard? I put 1,5 gigabytes of RAM into the machine for my enjoyment, not to fill some caches. And if the computer thinks it’s a smart idea to cache the last 200MB of stuff I wanted to copy once or the gigabyte file the bit torrent client uses, well, then it has got its priorities way off.

While I don’t understand it, I keep having the impression that OS X’s memory usage doesn’t want to be understood. And that it’s not terribly good either. But then, I’m the guy who also doesn’t understand how it makes sense to quit a web browser (Safari) with no windows open and having 300MB of free memory afterwards.

Let me finish with some more info-graphic junk. After listening to Scott’s recent rant on browser memory usage, I tried to just compare a few browsers by opening the same two pages (this one and Apple’s) in all of them. And looking at the memory usage afterwards. While I wouldn’t claim that this is meaningful in any way, there’s at least a colourful picture to share:

screenshot of memory usage of different browers. Explorer an Opera use the least memory.

So Explorer or Opera rock or what?

June 1, 2006, 0:11

Tagged as software.

Add your comment

« NooooMainFinder Duplicates »

Comments on

Photos

Categories

Me

This page

Out & About

pinboard Links

♪♬♪

Received data seems to be invalid. The wanted file does probably not exist or the guys at last.fm changed something.

People

Ego-Linking