(from a recent reader mail - see below for replies last updated 10PM Eastern)
"OSX 10.4.10 + MacBook Pro memory leaks
I've noticed sluggish performance over time on my Santa Rosa MBP if I don't reboot. Recently I installed menumeters and now I know
why. This machine has severe memory leaks that build up over time.
On first boot, the machine uses 330MB without apps running.
With Safari and Mail running, it jumps to 370MB or so. Over time,
as more windows open and close, that jumps to 420MB. And quitting those apps doesn't restore free memory.
And restarting the apps after quitting brings the new total higher each time. After using a few more apps and quitting, over the course of a few days, the machine ends up using 850MB+ even after all the apps are closed and we are back to finder only.
That's 500MB of memory leaks using Apple applications (not any third party apps...) Have you had reports of such severe memory leaks?
(Not that I recall recently, at least since one of the tiger updates (or a java update?) in the past fixed memory leaks with Widgets IIRC. But see the replies today to this.-Mike)
No (it does not recover over time). It seems to get even worse when sleeping, then waking. My machine just woke up after being asleep
for 8 hours, and with Mail.app and Safari running, it is using 566MB. When first booted, those two apps plus Finder use about 360MB. This machine was rebooted about 18 hours ago, so the leak has grown quite a bit in a short amount of time.
Activity Monitor shows:
I'll reboot now and let you know what it reads after the reboot...
After reboot Activity Monitor shows:
PS - My machine also will not "self sleep" with the power adapter plugged in no matter what the settings. Running on batteries,
it will sleep normally. This has been the case from day one..."
I don't have an intel-based Mac, but on my main work machine (PB G4 1.33/17in/10.3.9) I leave Safari and FFox open for weeks with dozens of pages at times open - and over time FF seems to grow to use so much CPU time I have to quit it. (I haven't checked memory usage though.) And I see the BBOD at times even in Safari with some pages (typically those full of flash video/ads, etc.) I usually force quit it in frustration instead of waiting and waiting to get control back. But to be fair this machine really needs a drive upgrade (only about 8GB free) and it hasn't had a clean install ever. Otherwise it's been rock solid in daily use for several years.
Replies: (later reports first)
"I would like to respond to the person attacking my comments because he is acting as if I didn't consider any of what he wrote, and being quite rude about it to boot. (referring to "Michael W.'s" comments 2 posts below) Further, I think you know I don't tend to "make stuff up" like he is insinuating.
Clearly, like in XP and Vista, when you boot an app like Safari in OSX, then quit it, then reboot it, it will boot faster the second time because "helper" kits and files (resources) are loaded into memory on first use and tend to remain there for reuse should they be called. I'm pretty sure anyone who knows how modern OS's work is aware of this, even if they don't know exactly how it is accomplished. This is superior to how OS9 worked with all the competing extensions loaded at launch.
But his explanation for my memory "leak" is lacking because it does not explain why starting and restarting the same app will lead to a ballooning of memory use over time. By his explanation, once Safari loads, it will load what it needs, then reuse it on next launch. If it needs something else next time around (due to visiting a new website that requires some more resources) it will load that into memory as well. But somewhere, some of these resources are being loaded multiple times into memory, both in the active and wired areas, and are not being released or reused. This is the only way I can explain why memory use continues to grow.
Further, this is also evident in iWork '08 apps, and quicktime player, and iTunes. In fact, I rarely use any non-Apple apps anymore. And since these apps are "static" apps in that they use the same resources each time (and with Numbers, I'm working on the same one file day for 4 weeks straight now...), it is illogical to explain away that they continue to assign more and more memory with each launch to "new" resources. My thinking is that the OS is constantly losing track of what is in memory when apps are quit, and then when an app is launched, it must reload resources it lost track of, and the other memory space is not being released.
And isn't this what a memory leak is? Slowly taking up more memory due to losing track of loaded information without releasing the old memory?
So while this person may doubt my experiences, when I see 900MB in use with no apps open and notice sluggish performance where there was
no sluggishness the day before, why am I wrong for guessing that something is wrong? And when I reboot and the performance returns and the memory used drops to 330MB, it sure seems like something is up. (Oh, and I don't use widgets, and don't ever launch Dashboard and
have removed it from my Dock to avoid memory and security leaks, so I don't think that's causing it.)
But what do I know? That's why I asked the question...
PS - I don't think anything I installed is causing lack of sleep issues, because it has been like this since I got the machine 2 months ago. Even the first day, when I was charging the battery to full before even installing anything on the "factory" system, it would not sleep while plugged in. It doesn't really bother me (as I just close the lid), and I am hoping Leopard fixes it, but it's interesting that others are having this same problem... And frankly, I don't care so much"
I have the exact same problem as the reader mentioned. I am using an MBP Santa Rosa 2.2 GHz with 2 GB of ram and I can verify I always have severe memory leaks.
I have been planning to format my hard drive and reinstall everything but haven't had enough time. Also, I have thought of adding some more RAM.
It's very annoying, I have to restart almost every 6 to 8 hours of work. I always use MS Office 2004 (runs under Rosetta), Safari, Adium, Itunes, Filemaker Pro 7, Remote Desktop, and Network Utility open at the same time, and occasionally I have to run Parallels with Win XP Pro.
With my Powerbook G4 I had 1.25 GB of ram, and rarely I had to restart, using the same apps (except for parallels, Virtual PC 7 then) Hope someone else have the same problem, and found some solutions, or perhaps Leopard will fix this bug, which I suspect happens with most of the
(reply to Mike K's original comments memory use)
This sounds all very inaccurate; hazy information without enough data to make any determinations whatsoever. Severe memory leaks?
Determined how? MallocDebug? (Activity Monitor - see his later comments above and his reply to your comments) None of these numbers sound particularly crazy, but furthermore, they're WAY out of context. What numbers is this person quoting? There are several memory figures that a utility like top will display. This person's account is factually lacking and shouldn't be used as evidence of anything at all without far more information.
It also sounds like this person is misunderstanding memory stats may be reading. This is reused from a forum post I made on the subject a
few years ago on the topic of reading memory usage output from top:
Here's a theoretical stats output from top:
PhysMem: 56.6M wired, 188M active, 255M inactive, 499M used, 13.0M free
This machine has a half-gig of RAM.
Ack! Only 13 MB free?
(BTW - here's an apple doc I've linked to in the past also - Mac OS X: Reading system memory usage in Activity Monitor-Mike)
Here's what top is really saying when you read that line of the display:
"56.6 MB of your RAM is wired down. This 'wired' memory cannot be paged to disk (1); it must remain in physical RAM until it is no
longer needed, period. 188 MB of your RAM is active and not wired down. Apps are using this and if something else absolutely needs more
RAM, I can use this pool and page memory to disk. I don't like doing this, but I will if I really have to. 255 MB of your RAM is inactive.
Apps used this data at one point, and there's still that data in this section of RAM, but it isn't being used. I'll keep it here in case
those apps need it again. That way, I won't have to retrieve it from the (slower) HD again. If another app needs memory, I'll reuse it
before I reach into active memory. 499 MB of your RAM, in total, is being used in one way or another--this is the amount of RAM that has
something in it, regardless of whether or not it's being used by anything right now. You have 13 MB of completely clear RAM; this area
of memory is empty."
To see what you /actually/ have free, add inactive to free. That's RAM ready to be used at any given moment. Active will be used when
that's used up, and after that, you're gonna be swapping back and forth to disk more often than you click the mouse.
The computer doesn't bother clearing inactive memory, since it can just reuse it whenever it wants and the memory system is protected,
anyway. (The data sitting there from your last app isn't going to screw up anything else, so why bother wasting time to clear it when
it's free for use by something that needs it? :-))
Check out why data stays in RAM until something else needs that room:
1. After a fresh restart, launch Safari.
2. Quit Safari.
3. Relaunch Safari.
It was faster the second time, because the computer didn't have to pull everything from the HD all over again. Since the computer
doesn't know when you're gonna decide to do something that would require data you've used recently, it just keeps as much as it can
around, flushing and reusing it when needed. Inactive, free--it's all the same to the computer.
(1) "Paging to disk" is jargon for "moving the contents of physical RAM to the HD temporarily to make room for something else". It's done
when necessary by the virtual memory system. It's a good thing, regardless of what some users might tell you. Excessive swapping back
and forth (to disk, back to RAM while swapping something else out, back to disk, etc.) is a typical sign of not having enough physical
RAM installed in your computer for what you're doing. (E.g., running Photoshop with only 128 MB of RAM in your machine.)
I wanted to pass along a tip about memory leaks and sleeping issues on a MBP. Until recently, I too was having a number of issues with
memory leaks in Safari 2.0.4, I believe mostly due to the Adobe Flash Player. After updating Flash Player to the latest beta (http://labs.adobe.com/technologies/flashplayer9/) that includes H.264, it
seems these issues have gone away, although the performance of this beta Flash Player leaves A LOT to be desired on my 2.16GHz C2D MBP.
As far as any sleeping issues... I was experiencing an issue where my MBP would reboot itself quite often when I closed the lid. I am
pretty sure this turned out to be a problem with having 'Safe Sleep' enabled. Since disabling Safe Sleep mode (instructions here), I haven't had any sleeping issues. I have 2GB of RAM installed in this system, and 1GB of that was not supplied by Apple, so I guess it is possible that Safe Sleep mode has a problem with the type of RAM that I have installed?
Readers should be very careful when they try to look for memory leaks under OS X. Activity Monitor lists four types of memory: wired,
active, inactive, and free. (Again, see Apple's Mac OS X: Reading system memory usage in Activity Monitor-Mike) When an application is quit, only it's non-system cacheable memory is returned to "free". For example, any read-only resources, such as images, loaded files, or code, will stay in memory as "inactive". This is done since there is no penalty for re-using inactive memory and if the resource is needed later it can be read from memory much faster. To figure out how much memory your machine is using you should check the sum of the "inactive" and "free" values, and not just look at the "free" value. Remember that
here "free" means "unused", and that the OS tries to keep as much memory used as possible to improve performance.
I have a MBP 17" Santa Rosa which I think is wonderful. However, I have the same issues as the commenter (memory and sleep). However,
like Mike K., I also had these same issues on my last generation PB G4 15" Hi-res! So, I don't think its necessarily the MBP/Intel/SR but
something else. My impression with the sleep issue is that it is either something that crept in with the hibernate add-ons (which came
in with later gen powerbooks) OR there is some other process that is taking up cpu. By coincidence I also use menumeters which I think is
great. One of my thoughts is that if not menumeters it maybe some other utility that is stopping sleep, or a start-up process.
I took my MBP to the genius bar, and he acknowledged the sleep problem by seeing it also on an MBP 15". One way to test this would
be to create another user account with nothing running. I haven't had time to check this properly. In my case, sleep sometimes doesn't
kick in on battery either, so although screen dims following the settings, it never goes to sleep and runs out of juice! Very annoying.
On the memory leak, I think this has been around for sometime and is a webkit issue. For me both Safari and NetNewsWire (which is webkit
based) exhibit this. I find it's a good idea to quite these two apps every 5-7 days. The memory is cleared up (for the most part), as
shown by menu meters and also you may see a decrease in the VM being used. I know Webkit had some serious memory leaks once. I thought
these had been fixed, but I'm not so sure. There is another faint possibility again that the reader runs similar software to me, and we
see it particularly badly. One possibility is that migrating from older machines brought with it something that causes this problem
(and possibly the sleep).
Another problem I have observed on both my last 2 machines (though only once on the MBP in 3 months) is a COMPLETE freeze when Command-
Tabbing between apps. The system has to be rebooted. There is no kernel panic, and the console/system logs are completely devoid of
any information indicating a problem. It may be that the system itself has not frozen, but the input has (ie keyboard and trackpad).
The cursor will move around with trackpad, but nothing except the power button works. This is for me the bigger things as it is quite
easy to lose a lot of work from unsaved changes.
I wish these frustrating issues could be fixed as the machine would then be as perfect as it could be!
Kind regards, Ian
OWC XYM SPECIALS!
= UPGRADES by Mac =
Upgrades just for
= Refurb Mac Pros =
(Click for List)
SSDs from under $50!
Fast SSDs for Most Macs/PCs
= ThunderBolt =
Drives, Docks & More
= HARD DRIVES =
Up to 12TB HDDs
HGST, WD, Seagate, Toshiba
= 2.5in HDs & SSDs =
Notebook Hard Drives and DIY drive/case kit bundles
= MEMORY =
Lifetime warranty RAM Upgrades!
= OPTICAL DRIVES =
Internal and External Superdrives/Blu-Ray drives
= VIDEO / DISPLAY =
Graphics cards, Displays, Adapters, Cables & more
= AUDIO ITEMS =
Interfaces, Cables, Software, Speakers, Headphones & more
= SOFTWARE =
Apps, Utilities, OS, VM, Games and more
= WIRELESS =
WiFi and Bluetooth Devices/Adapters/More
= Repair Service =
for iPhone, iPad, Macs
= iPad/iPhone/iPod =
Accessories, Cases, Repairs & More
NuGuard iPhone Case *Extreme* Drop Tested!