HomeThinkDifferentStoreMacBoardsAdvertisingRSS SyndicationNewsletterContact

iTunes_RGB_9mm

Cool Mac Gear


iPod Video
iPod nano
iPod 1G-2G
iPod 3G
iPod 4G
iPod Mini
PowerBook-iBook
Garageband

OSX
OS X Odyssey 272 - Memory Usage Getter And Memory Leaks (Or Not?

Thursday, February 27, 2003


By Applelinks Contributing Editor Charles W. Moore

As I mentioned on Tuesday, I downloaded the Memory Usage Getter utility, and have been employing it for the past couple of days in aid of tracking down the presumed memory leak that is causing OS X to hit the RAM wall after about two days of use.

Memory Usage Getter is a small application that monitors the memory usage of all open applications. It displays the name of the applications (instead of some cryptic name) and the memory usage of the applications, both graphically and quantitatively. The list is also sorted in terms of memory usage, so you can always see which process is using up the most memory just by glancing at the window. Memory Usage Getter displays the memory usage of background UNIX processes, and allows the user to sort the processes that he is running into two tabs, for easy viewing, with a third reserved for system processes.

Memory Usage Getter is indeed another very interesting little RAM monitor, and I now know which apps are hogging the most memory, but I'm not sure how much farther ahead I am with that knowledge. I'm still running out of RAM.

Here's how it went. I rebooted into OS X 10.2.4 and started up my base suite of applications and utilities as well as Memory Usage Getter, which displayed this screen showing that 208.77 MB of my 640 MB of RAM was in use. Sos far, so good, but I hadn't done anything yet.

I then started up more programs, for a total of about 16 open. I was now using 356.375 MB of RAM. or more than half the total.

By the end of Tuesday evening, RAM usage was up to 473.52 MB, but thigs were still running smoothly when I shut down for the night.

By lunch time on Wednesday, after my morning Applelinks news productiuon session, I was up to 550.691 MB usage, with less than 100 MB of RAM still free.

By early evening it was up to 592.336 MB, or less than 50 MB left. The MUG window identified Mozilla as the most greedy RAM eater, with Safari, the Classic Environment, Tex-Edit Plus, and Nisus Email the runners-up. The browsers and TE+ all had quite a few windows open (and windowshaded with WindowShade X) as is my usual practise. iCab, interestingly, was using substantially less RAM than Mozilla or Safari, although it had several open windows too.

At mid-evening, I was essentiallly out of RAM. I needed to start up iListen to do some dictation, which required shutting down Safari and Nisus Email temporarily to avoid pageouts. The dictation went OK, but after I restarted Safari and Nisus Email, I was out of RAM and the Memory Stick pageout chime started going off when I switched application windows. MUG showed 627.609 MB of RAM in use out of 640 MB, after just about 28 hours since the last reboot.

Quitting all of the browsers plus Nisus Email dropped RAM usage back to 531.113 MB, and restarting them again only pumped the RAM use up to 578.016 MB, but that was with no windows open.

So, I'm not sure any of this qualifies as a memory leak or not. Freshly started Mozilla still wants 36 MB+ -- down from 50 MB+ before the restart. That doesn't seem like a horrendous difference. My provisional conclusion is that I'm just running out of RAM because of the many open applications and open document windows.

The MUG Help files note:

"When a computer was left on for a long time in the Classic Mac OS, and many applications were opened and closed, the system sometimes could not use all available memory for an application that was going to be launched. This was because the operating system needed a contiguous segment of free memory, and after opening and closing a lot of applications, free memory could get severely fragmented. The net result was that an launching application often had less total memory available to it than the actual free amount, since it could only use the largest contiguous block of free memory.

"Another problem with memory management in the Classic Mac OS was that a crash in one application's memory segment could overflow into another application's memory segment, making the crashing application crash another application. This effect would rapidly continue, often bringing down the whole operating system when only one application crashes, forcing the user to hard restart the computer."

The thing is though, at the practical level, I'm not doing essentially anything different in OS X than I do in OS 9 in terms of how I work. Indeed, I was able to comfortably run a similar suite of applications efficiently in OS 9.1 on my old WallStreet PowerBook with just 192 MB of RAM, and rarely hit the RAM ceiling (application sizes reduced with Virtual Memory enabled). With 640 MB of RAM in my Pismo and iBook, I never think about running out of RAM in OS 9 and no VM.

The MUG Help says of OS X memory management:

"No longer do we have to manually assign the amount of memory we want to assign to a specific application. Mac OS X's memory management system dynamically assigns memory to applications, so if an application needs more memory to perform intensive tasks, Mac OS X will automatically assign it more memory (without having to relaunch the application). The effect? No more applications complaining about the lack of memory, and no more "Out of Memory" errors.

"In addition, if a computer doesn't have enough physical memory for an application, Mac OS X will automatically switch to virtual memory, allowing the application to rely on disk space for it's memory. This, of course, makes the application run much more slowly, but this feature of Mac OS X eliminates the need to manually turn on virtual memory. The amount of disk space used for virtual memory also is dynamically assigned based on the needs of open applications.

"Another benefit of Mac OS X is the fact that there is no requirement for a contiguous block of memory. Mac OS X therefore can use all of the available physical memory for an application before resorting to virtual memory. Furthermore, memory assigned to each application is protected from other memory segments, preventing application crashes from totally taking down the system."

Yes, sounds very nice, but if I have to keep quitting programs to silence the pageout alarm and/or logout/login to clear the memory, these advantages are largely negated, and while OS X doesn;t crash (at least not often), OS X apps. certainly do. I've lost a lot more unsaved data to unexpected quits in OS X over the past year than I have in OS 9 crashes, and that's with cumulatively spending about 4/5ths of my time in OS 9 until recently.

One answer, I suppose, would be to get more RAM, but I'm not inclined to do that with the Pismo, since it would require removing and discarding another 128 MB DIMM, and the iBook is already maxed out at 640 MB. Makes Apple's official 128 MB minimum RAM spec. for OS X a bit of a joke.

Anyhoo, Memory Usage Getter is a cool little application, and coincidentally yesterday a new version upgrade was released that makes it even cooler. This is what the new interface window looks like (note that I'm hitting the memory ceiling again this morning).


 
New in this version:
Added the ability to kill processes from within Memory Usage Getter. Just select a process in any list, and press the "Kill" button. Memory Usage Getter will ask you to enter your administrator password, and if correct, will kill the selected process and then automatically refresh the list of processes.
• Added a true Cocoa toolbar.
• Added French and Spanish localization.
• Changed the interface around a little, especially in the Preferences window.
• Toned down the registration dialogs to appease those who feel like using my program without paying.
• Other minor bug fixes and added features.
 
System Requirements
• Mac OS X 10.1 or later
• 1 MB of disk space.
• Enough memory to make OS X usable. ;)
Memory Usage Getter  
   
Memory Usage Getter is $5.00 shareware  

For more information, visit:
http://homepage.mac.com/simx/

***
The Dock
Memory Leaks
Broken Link to APM Tuner Download
Access to the download page for APM Tuner is denied
Displaying Your Mac's Serial Number In OSX

***

The Dock

From Andrew Main

Charles,

Like you, I kept the Application Switcher Palette open all the time in OS 9. I got the idea, actually, about a year ago when I started looking at OS X, saw how useful the Dock could be for switching between open apps, then realized that the same could be done in 9 by tearing off the Applications menu and configuring it as a vertical bar with small icons. I quickly became used to it, and now set it up that way on all clients' Macs.

I've been in X for about two months now (after reading, studying and thinking about it for a year), and after working with the Dock for a while, find it useful primarily as an app switcher. Of course I immediately moved it to vertical position on the right side; since vertical space is always at a premium on computer displays, it seems dumb to me the way developers keep adding more and more horizontal tool and button bars at the top and bottom: I generally turn them off entirely (e.g. AppleWorks, where everything on the button bar just duplicates items in menus, where they're out of the way until needed and anyone over 50 IQ can find them easily enough), or move them to the left/vertical position (Acrobat Reader). I also reduced the Dock's size from kindergarten level to approximately 32x32 icons, plenty big enough.

I tried keeping icons of all my frequently used apps in the Dock, along with icons of folders containing most of my apps and documents for quick access, but found it quickly became
(a) overcrowded when I opened any other apps (not already in the Dock), leaving no visible desktop space to, for instance, drag Internet addresses to make clickable link files (which I do often); and
(b) confusing having so many different kinds of things in the Dock.

So I was most happy to discover FruitMenu <http://unsanity.com/haxies/fruitmenu/>, which allowed me to recreate my former Apple menu, with a series of folders containing aliases of all the apps, utilities and documents I use even occasionally. And a "System Preferences" item with a submenu that works just like the old "Control Panels" in classic Mac OS Apple menu, so you can go to just the panel you want in one step. And ability to program keyboard commands for items like "Sleep," which allowed me to recreate Classic OS's cmd-shift-zero instant PowerBook sleep, annoyingly lost in OS X. (At first I tried cmd-shift-Z, but found it conflicted with some apps.) FruitMenu does a lot more neat stuff, to contextual menus as well as the Apple menu, and is well worth its $10 price. I literally breathed a sigh of relief after installing and configuring FruitMenu.

First time around with X I installed a number of interesting free/shareware hacks right away, but then found my PB wouldn't go to sleep on its own; after that and other problems led me to do a complete reinstall, I've been more careful, trying haxies out one at a time. FruitMenu requires Unsanity's Application Enhancer <http://unsanity.com/haxies/ape/> to be installed first (for some reason not mentioned on the FruitMenu page), so I tried the two of them for a while, and after everything seemed to be working okay...

Next I used TinkerTool <http://bresink.com/osx/TinkerTool2.html> to park the Dock at the lower right corner, thus anchoring the Trash in its traditional position (though actually I almost always trash items via the keyboard, so seldom go to the Trash on-screen). Several other haxies can do this too. TinkerTool does a lot more neat stuff, like putting double arrows at both ends of scroll bars; everything it does is simply accessing options already built into X which Apple for some reason has not made available to users (double arrows in scroll bars were also built into OS 8/9, but never made available to users until third-party freewares accessed them), so it's not really a "hack" in the sense of adding any low-level activity to the System. And it's free.

So now I use the Dock essentially just as an Application Switcher, for which it's fine. I do keep a few of my most commonly-used apps (Eudora, Chimera, TextEdit, AppleWorks [despite that it's not really an X app yet, and actually less use than in 9, it's all I've got until a real Cocoa/Unicode WP appears--hopefully the next AW, rumored to be coming in April], Preview, and StuffIt Expander, for instant access and drag-and-drop) in the Dock, along with an icon of my Documents folder--thus essentially duplicating what I used to have on the desktop in 9.

And I use the X desktop very little: I find I actually see it rather seldom, and I've turned off hard disk icons appearing there (in Finder preferences), instead having aliases in a folder in the Apple menu, and generally try to keep everything in folders in my "data" volume--which is better anyway, so as not to lose things or forget to back them up. X _is_ different, and I'm finding it more useful to learn its own ways rather than trying to force it to duplicate 9 (except for the Apple menu, where I find best a combination of X's always available Sleep, Restart, Log Out etc. with classic's universal access to apps and documents).

Way back when I first read about OS X, my first thought on the Dock was that it would be just like the Control Strip--necessary (for Internet access at least) but always in the way. I was glad to see the CS go, and Internet access move to the menu bar, where I always put it when I could with third-party utilities like FreePPP or Internet Menu (which didn't work in late classic OS versions). So I don't really use the Dock for CS tasks, which I always preferred to access thru the Apple menu (i.e. control panels, now System Preferences) if possible.

I've never used windowshading much, nor Finder tabs, so haven't felt the need to minimize documents to the Dock--which obviously would lead to confusion as complainers say. In classic OS, I had a folder in the Apple menu with aliases of my two dozen or so most-used documents: letter and label templates, postal rates, folders of currently hot projects, etc. FruitMenu works just like the old Apple menu: if I select one of these folders, it opens immediately so I can add items to it. _Very_ nice. AND FruitMenu allows selectable multiple submenus, with icons, more than the classic Apple menu did--essentially duplicating one of the greatest Mac sharewares of all time, the System-7 era PopupFolder, which really augmented the Apple menu (as well as providing "contextual" folder lists and sub-lists, much superior to Apple's "spring-loaded folders").

Next I'm going to use one of several utilities to clear the Dock background, which I think looks nicer: just icons against the desktop. I have run into a problem here: when I try to copy Unsanity's ClearDock to the ./Library/Application Enhancers folder (where FruitMenu already resides), I'm told that folder cannot be changed. Repairing permissions doesn't help. Other Unsanity haxies come in installers that require admin password to install, but I can't figure out how to do it when just dragging the item to the folder--though I'm already logged in as admin, since I'm my only user. I suppose I could log in as root and put it there, but I'm nervous about such a "solution" to a problem that shouldn't be happening in the first place. Have to figure this out.

Other X enhancers that look interesting are Metallifizer (also from Unsanity), which gets rid of that unsightly metallic skin on apps like Safari (which I'll try seriously when it gets tabs), and Scrapper, to duplicate the old Scrapbook, for which X offers no real alternative.

What OS X most needs is good Cocoa apps that can really use its Unicode capabilities, Services, etc. Carbon is workable for the transition, but not the long run.

Andrew Main

___

Hi Andrew;

Your Doc usage pretty much mirrors mine - ie; it's an application switcher -- just not as good a one as the real AS palette in OS 9.

However, I use the Desktop and WindowShading extensively. Different Strokes.;-)

Charles

***

Memory Leaks

From Mel

Charles,
In Odyssey 270 you wrote:

"my out-of-memory problem chronicled most recently yesterday in Odyssey 269, are very likely a consequence of a memory leak -- a term that is new to me, and an issue that is particular to operating systems that use dynamic memory. "

The last part of that sentence is not entirely true. Memory leaks could also be a problem on OS 9. Memory leaks are a consequence of a programming language, not an operating system. They are most prevalent in the C and C++ languages (but can occur in others), as they require programmers to handle many aspects of memory allocation. If memory allocation is handled incorrectly, e.g. memory is not freed up after it is used, and this is repeated over time, the memory will be consumed (that is, leaked) and the application will ultimately run out of memory. This will result in the short term in a great deal of page swapping, and in the long term system instability or crashes. In OS 9 the program, since its memory allocation cannot be expanded, will crash or become unstable when it has leaked all its memory. In OS X, each application is allocated a very large virtual memory space, but uses only the necessary physical memory space. Therefore, the program is less likely to run out of memory or crash, but will slow down as the pageouts become more frequent. Since the OS X memory is in a separate virtual memory space, such a program will not destabilize the OS, as a misbehaving program could do on OS 9.

The OS can have memory leaks if it is not properly debugged, but applications are much more likely to have the problem, especially for programs whose authors cannot afford the expensive specialized programming tools to specifically check for leaks.

Regards,
Mel Krewall

***

Broken Link to APM Tuner Download

From Milton Aupperle

Hi Charles;

Clicking on

http://www.macupdate.com/info.php/id/6434
or
http://www.macupdate.com/info.php/id/6435

only gets you to "MapUpDate"

However the Donwload Link(s)

http://www01.u-page.so-net.ne.jp/gb3/eijim/files/APM_Tuner_X_1.0a2.dmg.sit
or
http://www01.u-page.so-net.ne.jp/gb3/eijim/files/APM_Tuner_folder.sit.hqx

on MacUpdate sites gives a 404 error.

So apparently this utility is no longer available.

TTYL..

Milton J. Aupperle
President
ASC - Aupperle Services and Contracting
Mac Software (Drivers, Components and Application) Specialist
http://www.outcastsoft.com

___

APM Tuner

From Steve

Charles,

Access to the download page for APM Tuner is denied

Steve

___

Hi Milton and Steve;

You're right, alas. Same deal with the links at VersionTracker. :-(

I've posted an update to the article to this effect.

Thanks for the heads-up

Charles

***

Displaying Your Mac's Serial Number In OSX

From Russ Calvert

Hi Charles,

Your instructions for displaying a Mac's serial number with the "About This Mac" feature only seems to work on some (newer?) Macs. For example, while it works on my 2x450MHz G4, it doesn't work on my beige 300MHz G3 - clicking on the build number just returns to the version number.

All the best,
Russ Calvert

___

Hi Russ;

Right; it works only on Macs about three years old or newer. I've amended the article to note that. Thanks for the heads up.

Charles

***

The OS X Odyssey archives may be accessed here:
http://www.applelinks.com/news/odyssey/

***

***
Charles W. Moore

Note: Letters to Moore's Mailbag may or may not be published at the editor's discretion. Correspondents' email addresses will NOT be published unless the correspondent specifically requests publication. Letters may be edited for length and/or context.

Opinions expressed in postings to Moore's MailBag are those of the respective correspondents and not necessarily shared or endorsed by the Editor and/or Applelinks management.

If you would prefer that your message not appear in Moore's Mailbag, we would still like to hear from you. Just clearly mark your message "NOT FOR PUBLICATION," and it will not be published.

CM

***
Charles W. Moore

Note: Letters to Moore's Mailbag may or may not be published at the editor's discretion. Correspondents' email addresses will NOT be published unless the correspondent specifically requests publication. Letters may be edited for length and/or context.

Opinions expressed in postings to Moore's MailBag are those of the respective correspondents and not necessarily shared or endorsed by the Editor and/or Applelinks management.

If you would prefer that your message not appear in Moore's Mailbag, we would still like to hear from you. Just clearly mark your message "NOT FOR PUBLICATION," and it will not be published.

CM


Charles W. Moore

Email This Article - Comment On This Article

Recent News
Page: 1 - 2 - 3 - 4 - 5

.

Reader Specials

Server Racks Online:
Apple Xserve CompatibleServer Racks and Universal Network Racks
42U KVM Switch Solutions:
High-End Mac and Multi-Platform KVM Matrix switching solutions!
Digital Camera Online:
Great prices on Digital Cameras and accessories!
KVM Switches Online:
Great prices on Mac KVM Switches from the leading manufacturers!
LCD Monitors Online:
Great prices on LCD Monitors from the leading manufacturers!
LCD Projectors Online:
Shop online for LCD Projectors from the leading manufacturers!
USB 2.0 Online:
Great prices on USB 2.0 products from the leading manufacturers

Serious Business Software:
Accounting, Sales, Inventory, CRM, Shipping, Payroll & more!

KVM Switch solutions for MACs:
DAXTEN is a KVM switch, KVM extender and monitor splitter specialist for PC, SUN and MAC applications from name brand manufacturers - offices worldwide.

The "Think Different Store: The iPod Accessories Store - iPod cases, iPod mini, iPod photo, speakers, itrip, inMotion, Soundstage and all other iPod accessories

Earn Cash with the ThinkDifferent Store Affiliates Program

Need A Web Site?
Applelinks Web Hosting Starting at 19.95 a Month

iTunes_RGB_9mm

iTunes_RGB_9mm

Cool Mac Gear


iPod 1G-2G
iPod 3G
iPod 4G
iPod Mini
PowerBook-iBook
Keyboard Skins
Garageband