User Name
Password
AppleNova Forums » Genius Bar »

Where is all my memory being tied up?


Register Members List Calendar Search FAQ Posting Guidelines
Where is all my memory being tied up?
Thread Tools
torifile
Less than Stellar Member
 
Join Date: May 2004
Location: Durham, NC
Send a message via AIM to torifile  
2008-12-12, 14:35

I've had a crazy amount of pagein and outs lately. I checked activity monitor and I've got half a gig of RAM tied up inactively. I have no clue where it is. I've got 2 gigs of RAM but my computer has been terribly slow of late. I've got about 40 gigs of free space on my HD so that's not it.

I'm running 10.5.5 on a 2.2 ghz Core 2 Duo MBP. Any thoughts? How can I free up some of that inactive RAM?
  quote
PB PM
Sneaky Punk
 
Join Date: Oct 2005
Location: Vancouver, BC
Send a message via Skype™ to PB PM 
2008-12-12, 14:49

What applications are you running? Do you use a lot of tabs in your web browser?
  quote
Taskiss
Veteran Member
 
Join Date: Jul 2007
Location: St. Louis, MO
 
2008-12-12, 15:10

Use the activity monitor, Luke.
  quote
curiousuburb
Antimatter Man
 
Join Date: May 2004
Location: that interweb thing
 
2008-12-12, 15:41

Dude, this sooooo calls for a poll.

Where is all my memory being tied up?
  • Out on Safari (particularly with multiple windows/tabs with plugins or jibba jabba java)
  • Stashed in Dashboard (some widgets don't unload from RAM very efficiently once loaded)
  • Looped in limbo by crufty app and os permissions gnomes each resetting chmod
  • In the file system hideout while bad code banditos fight it out
  • Held hostage by the magic hamsters powering your computer... until their demands are met
  • On the railroad tracks by a dastardly VM villain (Blame Redmond)
  • In Beer... memories of great beer, time since last beer, location of nearest beer

All those who believe in telekinesis, raise my hand.
  quote
Luca
ಠ_ರೃ
 
Join Date: May 2004
Location: Minnesota
 
2008-12-12, 15:44

Safari and Dashboard are the two biggest culprits.
  quote
Bryson
Rocket Surgeon
 
Join Date: Feb 2005
Location: The Canadark
 
2008-12-12, 16:04

I was going to suggest Dashboard too - got lotsa widgets open?
  quote
curiousuburb
Antimatter Man
 
Join Date: May 2004
Location: that interweb thing
 
2008-12-12, 16:20

It's even more fundamental...

If you boot and don't open Dashboard your system uses less RAM than if you open Dashboard ever (even with subsequent closure).

Widget cleanup is sloppy, and a clean boot may illustrate (via Activity Monitor) just how much, depending on your widgets.

All those who believe in telekinesis, raise my hand.
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2008-12-12, 16:31

Or occasionally "killall Dock" to wipe out Dashboard.
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2008-12-12, 16:47

Quote:
Originally Posted by curiousuburb View Post
It's even more fundamental...

If you boot and don't open Dashboard your system uses less RAM than if you open Dashboard ever (even with subsequent closure).

Widget cleanup is sloppy, and a clean boot may illustrate (via Activity Monitor) just how much, depending on your widgets.
I find it to be around 25-40MB per instance, per widget. It adds up quickly.
  quote
torifile
Less than Stellar Member
 
Join Date: May 2004
Location: Durham, NC
Send a message via AIM to torifile  
2008-12-12, 22:07

I should have been more specific - why do I have so much inactive memory when I'm constantly getting pageins and outs? Shouldn't stuff in inactive memory still be fast and paged out stuff take some time? It's as if everything has paged out but that's certainly not the case.

As for widgets, I've only got 3 going. The calculator, the weather and one called "organized" by iSlayer.
  quote
Enki
Senior Member
 
Join Date: Nov 2004
 
2008-12-12, 23:23

Quote:
Originally Posted by torifile View Post
I should have been more specific - why do I have so much inactive memory when I'm constantly getting pageins and outs? Shouldn't stuff in inactive memory still be fast and paged out stuff take some time? It's as if everything has paged out but that's certainly not the case.

As for widgets, I've only got 3 going. The calculator, the weather and one called "organized" by iSlayer.
Inactive memory is the opposite of tied up. Inactive means the program that had been using it was either terminated or the program released that memory. Since it had been previously used it is put on the inactive list instead of all the way onto the free list. This can be a very good thing, because if the program is restarted or requests the same resources that had been in the inactive memory, it is just transfered to the active list and no need to hit the HD for it all over again. HUGE time savings at computing speeds.

If inactive memory is not re-used and free memory goes below 10%, some of the inactive memory will be transfered to the free list, enough to put the free list back over 10%..

This is just a very clever way of implementing lazy evaluation in the name of maintaining some deference to the principle of locality. Overall a very intelligent way to handle memory management.

Page-ins are nothing to worry about. Every page loaded into RAM shows up as a page-in no matter what. Lots of page-outs means you don't have enough RAM for how you are using the computer. Currently 2GB with 10.5 is enough to run adequately, but if you like to leave apps running in the dock and not quit them you really need 4GB+.
  quote
torifile
Less than Stellar Member
 
Join Date: May 2004
Location: Durham, NC
Send a message via AIM to torifile  
2008-12-18, 13:09

Quote:
Originally Posted by Enki View Post
Inactive memory is the opposite of tied up. Inactive means the program that had been using it was either terminated or the program released that memory. Since it had been previously used it is put on the inactive list instead of all the way onto the free list. This can be a very good thing, because if the program is restarted or requests the same resources that had been in the inactive memory, it is just transfered to the active list and no need to hit the HD for it all over again. HUGE time savings at computing speeds.

If inactive memory is not re-used and free memory goes below 10%, some of the inactive memory will be transfered to the free list, enough to put the free list back over 10%..

This is just a very clever way of implementing lazy evaluation in the name of maintaining some deference to the principle of locality. Overall a very intelligent way to handle memory management.

Page-ins are nothing to worry about. Every page loaded into RAM shows up as a page-in no matter what. Lots of page-outs means you don't have enough RAM for how you are using the computer. Currently 2GB with 10.5 is enough to run adequately, but if you like to leave apps running in the dock and not quit them you really need 4GB+.
Ok, here's the thing: I've got 500+ megs of inactive memory right now and only 18 megs free memory, so my computer is slower than shit. My hard drive is clicking like crazy. I'm just using Safari, Mail and NNW actively right now and my CPU isn't being pegged. What gives?
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2008-12-18, 14:10

Er, clicking?

I've seen disk corruption give rise to super slow performance. Try running Disk Utility.

FWIW, I frequently have under 20MB free on my *4GB* machine, with no slowdowns, *except when swapping apps*.

Right now it breaks down as:
Free: 85MB
Wired: 618MB
Active: 2.18GB
Inactive 1.13GB

This is with, um... 15 apps open, one of which is a coding editor with a dozen windows open (that's a dozen *projects*, not a dozen *documents*... each project has anywhere between three and fiftyish documents open, one is Safari with a dozen tabs, one is Lotus Notes (which is a *pig*), etc, etc, etc. All smooth as silk.

If you're not switching between apps like mad, and are staying more or less in one app (with the exception of Safari, which, every time you go to a new page, eats more RAM for caching), and it's *still* slow... something is wrong.

My guess is that there's something wrong with your drive. My mom's laptop had this issue a couple of years ago, almost feature identically: super slow, sounded like the VM was thrashing, etc, etc. It was that the drive was reporting error after error, and *eventually* it would read or write an uncorrupted block. This meant that every VM swap in or out was dirt slow, and the whole system came to a crawl. She had no other symptoms to speak of. It wasn't until she told me that her Finder preferences were getting reset every so often that the idea of drive issues came to mind.
  quote
PB PM
Sneaky Punk
 
Join Date: Oct 2005
Location: Vancouver, BC
Send a message via Skype™ to PB PM 
2008-12-18, 14:11

Quote:
Originally Posted by torifile View Post
Ok, here's the thing: I've got 500+ megs of inactive memory right now and only 18 megs free memory, so my computer is slower than shit. My hard drive is clicking like crazy. I'm just using Safari, Mail and NNW actively right now and my CPU isn't being pegged. What gives?
Okay, that is not a good sign, the hard drive clicking that is. IMO, 2GBs isn't enough for 10.5, I have 3GBs and often still feel constrained when using Pro apps. If you want to clear inactive memory, go into disk unity and run the repair permissions function, that always clears it up for me.
  quote
Maciej
M AH - ch ain saw
 
Join Date: May 2004
 
2008-12-18, 14:14

Isn't Mail a huge memory hog?
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2008-12-18, 14:16

Quote:
Originally Posted by PB PM View Post
Okay, that is not a good sign, the hard drive clicking that is. IMO, 2GBs isn't enough for 10.5, I have 3GBs and often still feel constrained when using Pro apps.
OTOH, I have 1GB in my MacBook for personal use, and it's fine for iLife, Safari, Mail, etc. It's not *snappy*, but it's more than serviceable.

Quote:
If you want to clear inactive memory, go into disk unity and run the repair permissions function, that always clears it up for me.
Huh? 'Splain the logic behind that one, sparky. I don't see the connection between VM and disk permissions.
  quote
torifile
Less than Stellar Member
 
Join Date: May 2004
Location: Durham, NC
Send a message via AIM to torifile  
2008-12-18, 14:31

Ok, maybe clicking isn't the right word. I can hear it reading/writing to disc. It doesn't sound out of the ordinary to me, but I'll run disk utility to be sure (OT: is it "disc" or "disk"?).

Ran Disk Utility and it says my drive is fine. In activity monitor, though, the "System Memory" tab has this:



Thoughts? (Bear in mind that my whole HD is 111 gigs, so 93 gigs for VM space seems weird.)

Last edited by torifile : 2008-12-18 at 14:44.
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2008-12-18, 14:50

I've got 68GB right now... that's not the size of your swap files, that's the size of all files memory-mapped, including multiple instances of System libraries, etc. Not unusual.

For how much your VM is *actually* taking up, look at the size of the folder /var/vm in the Terminal.

du -sh /var/vm

If you've put the machine to sleep since your last reboot, that includes your sleepimage, which is a copy of your RAM for safe sleep - subtract the total amount of your RAM from it. The above reports 6.0GB for me, and I have 4GB of RAM, so there's actually only 2GB of swap space being used.

Or, you could at the bottom of that column at 'swap used'...
  quote
torifile
Less than Stellar Member
 
Join Date: May 2004
Location: Durham, NC
Send a message via AIM to torifile  
2008-12-18, 14:53

I've also noticed that my computer can take, and will take more often than not, up to 30 seconds to go to sleep. Now this might be when it's writing the sleepimage file, I don't know, but it seems quite a long time.
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2008-12-18, 14:56

Yup, that's the sleep file. My 4GB takes twice as long. It's annoying.

I've been tempted to turn it off to save myself the wait time when I'm usually headed out the door to something (like a meeting), but otoh, it's saved my bacon a couple of times when I've left the machine sitting for a long weekend without charging.
  quote
PB PM
Sneaky Punk
 
Join Date: Oct 2005
Location: Vancouver, BC
Send a message via Skype™ to PB PM 
2008-12-18, 14:59

Quote:
Originally Posted by Kickaha View Post
OTOH, I have 1GB in my MacBook for personal use, and it's fine for iLife, Safari, Mail, etc. It's not *snappy*, but it's more than serviceable.



Huh? 'Splain the logic behind that one, sparky. I don't see the connection between VM and disk permissions.
We are talking about physical memory not VM here. Don't ask me why it works or how its related, I just know that repairing disk permissions clears out inactive RAM.
  quote
Kickaha
Veteran Member
 
Join Date: May 2004
 
2008-12-18, 15:07

Quote:
Originally Posted by PB PM View Post
We are talking about physical memory not VM here. Don't ask me why it works or how its related, I just know that repairing disk permissions clears out inactive RAM.
Weeeeeeird? I'll have to try that out. The only thing I can think of is that it forces the VM to release pointers to memory-mapped files so it can muck with the files. Hunh.
  quote
torifile
Less than Stellar Member
 
Join Date: May 2004
Location: Durham, NC
Send a message via AIM to torifile  
2008-12-18, 15:18

Quote:
Originally Posted by PB PM View Post
We are talking about physical memory not VM here. Don't ask me why it works or how its related, I just know that repairing disk permissions clears out inactive RAM.
Wow. That totally worked to give me more free RAM but it didn't come from the inactive RAM. It came from my active RAM. My inactive RAM stands at 500+ megs while my active went from 1.1 gigs to 700 or so. Is there a way to tell what's in inactive RAM?

It also weirdly dropped my page outs from nearly 4 gigs to 91 megs according to activity monitor. This is all very interesting.

Before:



After:

  quote
Enki
Senior Member
 
Join Date: Nov 2004
 
2008-12-18, 20:22

Quote:
Originally Posted by torifile View Post
Ok, maybe clicking isn't the right word. I can hear it reading/writing to disc. It doesn't sound out of the ordinary to me, but I'll run disk utility to be sure (OT: is it "disc" or "disk"?).

Ran Disk Utility and it says my drive is fine. In activity monitor, though, the "System Memory" tab has this:



Thoughts? (Bear in mind that my whole HD is 111 gigs, so 93 gigs for VM space seems weird.)
Quote:
Originally Posted by Kickaha View Post
I've got 68GB right now... that's not the size of your swap files, that's the size of all files memory-mapped, including multiple instances of System libraries, etc. Not unusual.

For how much your VM is *actually* taking up, look at the size of the folder /var/vm in the Terminal.

du -sh /var/vm

If you've put the machine to sleep since your last reboot, that includes your sleepimage, which is a copy of your RAM for safe sleep - subtract the total amount of your RAM from it. The above reports 6.0GB for me, and I have 4GB of RAM, so there's actually only 2GB of swap space being used.

Or, you could at the bottom of that column at 'swap used'...
Yeah, the VM listed has no actual base in real used memory. That number just reports the total potential bytes of virtual address that are currently in active pmaps. And almost always the majority of those are either totally empty or pointed at the contents of a file on the HD.

Quote:
Originally Posted by torifile View Post
Ok, maybe clicking isn't the right word. I can hear it reading/writing to disc. It doesn't sound out of the ordinary to me, but I'll run disk utility to be sure (OT: is it "disc" or "disk"?).

Ran Disk Utility and it says my drive is fine. In activity monitor, though, the "System Memory" tab has this:



Thoughts? (Bear in mind that my whole HD is 111 gigs, so 93 gigs for VM space seems weird.)
Quote:
Originally Posted by Kickaha View Post
I've got 68GB right now... that's not the size of your swap files, that's the size of all files memory-mapped, including multiple instances of System libraries, etc. Not unusual.

For how much your VM is *actually* taking up, look at the size of the folder /var/vm in the Terminal.

du -sh /var/vm

If you've put the machine to sleep since your last reboot, that includes your sleepimage, which is a copy of your RAM for safe sleep - subtract the total amount of your RAM from it. The above reports 6.0GB for me, and I have 4GB of RAM, so there's actually only 2GB of swap space being used.

Or, you could at the bottom of that column at 'swap used'...
Quote:
Originally Posted by torifile View Post
Wow. That totally worked to give me more free RAM but it didn't come from the inactive RAM. It came from my active RAM. My inactive RAM stands at 500+ megs while my active went from 1.1 gigs to 700 or so. Is there a way to tell what's in inactive RAM?
Not without special tools and knowing how to forensically decipher pmaps. Generally what is in there is the remains of stuff that has been used since the last boot, but isn't in use now. Such as closed documents, code from closed applications, unloaded temp files etc. As I said earlier, inactive memory is available for your immediate use, when immediate is considered at human timeframes. Literally is is a few microseconds away from being on the free list at any particular time.

This next example isn't particularly correct because HD's don't work this way, but maybe the example will work for you. Think of inactive memory as being like hard drive blocks from deleted files. The directory entry for the file is deleted, but the info is still on the HD. And if the filesystem was smart enough to keep track of all the deleted file sectors you could do Time Machine like recoveries without even hitting the Time Machine drive -- just replace the appropriate directory entry and your file reappears like magic -- all as long as those leftovers had not been claimed to provide space for some new file. There is no appreciable space or performance penalty if the system keeps the appropriate info continuously along on special files called maps, except for the little bit of RAM each map page needs. And if it is actually the case that this happens a lot with certain types of files, it can be a huge win performance-wise.

As I said that isn't quite right because HD's really don't do that, but it is just an example. To illustrate it for real, restart (not just logout, that will still leave Mail.app code as inactive) and time how long Mail takes to start up. Now quit mail and immediately re-launch it. For me it is a difference of only needing 1-2 seconds instead of about 15-20 seconds on startup & login. That is because as soon as you quit Mail it went into inactive memory, not straight to the free list. Kick may point out the cache is warm too, but that only helps a little because we need to re-enable the maps before those cache lines can become valid again, and the significant time is in getting the app into memory, not from memory to the CPU.
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
SD memory Dovek916 Purchasing Advice 8 2007-05-28 08:50
Memory for Mac Pro brutox Third-Party Products 11 2006-09-07 22:27
G5 Memory Kusakun Apple Products 3 2006-07-03 16:01
Where did my memory go?! bb823 Genius Bar 2 2005-07-21 04:54
G5 Memory kmanz Purchasing Advice 12 2005-03-30 10:16


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 11:27.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova