PDA

View Full Version : How do you clear inactive ram?




lisbakke
Aug 8, 2005, 05:38 PM
When I had 512 mb ram on my PB, nearly half or more was always dedicated to inactive memory. I bought 2 gigs of ram, and right now, I'm using 1.9/2 gigs... but 1.2 gigs of it is inactive.

When I used to use PC's I would use cacheman (or something like that) to free up inactive ram. How do I do this on 10.4.2?



alex_ant
Aug 8, 2005, 06:15 PM
You don't

Mac OS X is optimizing your ram, it's supposed to be that way... blah blah blah

lisbakke
Aug 8, 2005, 06:20 PM
I don't want to have 1.2 gigs of inactive ram and 40 megs of free ram... plus, sysstat and stickies widgets end up taking 250 megs of ram each after a while and i think that this is too much. Isn't there any remedy?

Applespider
Aug 8, 2005, 06:31 PM
Honestly, you don't need to worry about the inactive RAM. OS X handles memory much better than Windows. When you open a new app that requires memory, OS X will switch out the inactive RAM in the background. Unless you have oodles of RAM and very few applications open, you'll generally find you have less than 100MB free. OS X will use as much as it can whenever possible but since it's good at the inactive stuff, you shouldn't notice too much.

Those widgets are taking up quite a bit of RAM but that's probably more to do with the way in which they're coded. You could close them if it bothers you and reopen them.

lisbakke
Aug 8, 2005, 07:35 PM
I understand what you guys are saying, but the reason I got 2 gigs of ram was so that I would have no pages stored in virtual memory on disk. Even with 2 gigs of ram, I have page outs because osx is keeping all of the inactive stuff loaded. Wouldn't it be more optimum to prevent writing to disk (rather than ram) rather than just let everything stay in ram?

risc
Aug 8, 2005, 08:02 PM
I've said it before and I'll probably have to say it again:

Welcome to UNIX!

http://developer.apple.com/documentation/Performance/Conceptual/ManagingMemory/Articles/AboutMemory.html

chucknorris
Aug 8, 2005, 08:38 PM
I understand what you guys are saying, but the reason I got 2 gigs of ram was so that I would have no pages stored in virtual memory on disk. Even with 2 gigs of ram, I have page outs because osx is keeping all of the inactive stuff loaded. Wouldn't it be more optimum to prevent writing to disk (rather than ram) rather than just let everything stay in ram?

I don't think this can be stressed enough. It is SUPPOSED to be that way. OS X does a very good job of managing memory to optimize performance. If you are not actively using a lot of ram, then it will cache things in inactive memory for quicker loading. If you are actively using a lot of ram, then it will decrease the amount of inactive memory AUTOMATICALLY. It wouldn't make any sense for OS X to waste your memory, and force you to use virtual memory. Would it? You don't think Apple would be that stupid, do you?

lisbakke
Aug 8, 2005, 08:40 PM
Is this how it works?

You load programs, they take up ram, while they're idle, their inactive code stays in ram, so that when they are used, these sections don't have to be reloaded, allowing faster access speeds.

If you load a program, and don't have enough free memory for the new program, then it clears out some of the inactive memory to make space for the new incoming init data/code?

alex_ant
Aug 8, 2005, 09:03 PM
Is this how it works?

You load programs, they take up ram, while they're idle, their inactive code stays in ram, so that when they are used, these sections don't have to be reloaded, allowing faster access speeds.

If you load a program, and don't have enough free memory for the new program, then it clears out some of the inactive memory to make space for the new incoming init data/code?
Bingo

whydoyouwork
Aug 16, 2007, 04:49 PM
I have 4gb of ram in the latest (August 16th, 2007) MacBook Pro...

The memory management is actually quite horrible. At times I have 2gb of inactive memory... Even after I close down evertyhing but adium I still cannot get the space back.

So say I'm working rather quickly in Flash, Illustrator, and Dreamweaver while testing in Firefox and I need to start Parallels to load my bootcamp Partition of Windows with 512mb ram to test something in I.E... I have to restart, even if I close all the apps, it doesn't clear nearly enough memory...

This is my first time running OSX more than Windows in a development/design atmosphere... It manages memory worse than Windows when it comes to something like that. When 4gb and a 200gb hd aren't enough for proper multi tasking that I do on my windows machine at home without a hitch isn't enough... You're memory management is made for bloggers and students.

If anyone is wondering Vista flies on the MacBook Pro 17'. OSX is sluggish in comparison.

To clear memory, look up Dust on MacUpdate.com


To answer someone's question, "Do you think Apple would be that stupid?" Yes.

WildCowboy
Aug 16, 2007, 04:55 PM
2 GB of inactive memory is great...it's all there at your fingertips for when the app needs it. You shouldn't be able to get it back by closing down apps...it's still holding the data in case you reopen those apps. That's the whole point of inactive memory.

If you need that RAM for something new, it will happily give it up and let you use it. Memory management on OS X just works.

And if the app you're talking about is MacDust (http://theapplegeek.com/index.php?page=MacDust), I haven't used it myself, but I see nothing in its feature list that indicates that it would free up inactive memory.

Aea
Aug 16, 2007, 04:55 PM
...

This really just doesn't justify a response, but let's go over this again. This is by DESIGN, unused memory (cleared / closed program) is left in your RAM and effectively the same of free RAM, it can be freely used by any program and incurs no speed hit (in fact it improves speed since when you relaunch something which already exists in inactive, there's not as much load incurred).

The reason that parallels is slow is because it's a piece of crap.

Cromulent
Aug 16, 2007, 05:06 PM
How many times do people have to post the answer to this.

Inactive RAM is Mac OS X storing information from applications that you have opened in the past in case you open them again. This speeds up launch of said applications.

If you open a different application, Mac OS X will overwrite what it has stored in the inactive RAM and load the application. This is not using the hard drive at all. The only part that you need to worry about is swap which is hard drive space that Mac OS X uses when it runs out of real RAM.

Your just wasting your time restarting your computer to clear inactive RAM and probably doing it harm by constantly restarting.

I have 4gb of ram in the latest (August 16th, 2007) MacBook Pro...

The memory management is actually quite horrible. At times I have 2gb of inactive memory... Even after I close down evertyhing but adium I still cannot get the space back.

So say I'm working rather quickly in Flash, Illustrator, and Dreamweaver while testing in Firefox and I need to start Parallels to load my bootcamp Partition of Windows with 512mb ram to test something in I.E... I have to restart, even if I close all the apps, it doesn't clear nearly enough memory...

This is my first time running OSX more than Windows in a development/design atmosphere... It manages memory worse than Windows when it comes to something like that. When 4gb and a 200gb hd aren't enough for proper multi tasking that I do on my windows machine at home without a hitch isn't enough... You're memory management is made for bloggers and students.

If anyone is wondering Vista flies on the MacBook Pro 17'. OSX is sluggish in comparison.

To clear memory, look up Dust on MacUpdate.com


To answer someone's question, "Do you think Apple would be that stupid?" Yes.

iBookG4user
Aug 16, 2007, 05:08 PM
If you really want to free up memory, even though you don't have to then google an app called ifreemem.

whydoyouwork
Aug 16, 2007, 05:11 PM
Never said Parallels was slow. It's actually quite responsive... I don't restart constantly, I end up testing on another machine... I haver closed the old programs and have started new ones and it doesn't free the ram all the time. Parallels, Illustrator, and multiple other programs have trouble.

Yeah, I know you guys are telling me how it "just works" but I'm telling you how it doesn't. Notice how one is in quotes because it's from sort of commercial and the other is from real world experience.

Parallels won't start because it can't allocate the memory that mac has stored as inactive. To be clear, if I WIPE the inactive memory so it is FREE memory, I can start Parallels.

I've been working with computers since I was 9, I'm now 24... I have worked with OSX since it came out. It needs to grow up. BUT this is NOT an OSX versus windows debate by any means. It has ONLY to do with the fact that everyone responds as if memory in OSX is always perfect 100% of the time and if it doesn't work it's user error.

Funny, since there's programs like Dust and IFreeMem...


*hint hint* Don't bust someone's chops repeating something they've read 4 times in the same post if they still say it doesn't work... Credit the user, not the wonder that is OSX. No wonder Apple is slow to patch open source vulnerabilities and have issues like this, the response to problems is drone in quality.

iPhil
Aug 16, 2007, 05:21 PM
2 GB of inactive memory is great...it's all there at your fingertips for when the app needs it. You shouldn't be able to get it back by closing down apps...it's still holding the data in case you reopen those apps. That's the whole point of inactive memory.

If you need that RAM for something new, it will happily give it up and let you use it. Memory management on OS X just works.




Here's a simple Mac OS X Ram explanation page on  site: Mac Ram simple info site (http://docs.info.apple.com/article.html?artnum=107918)

Oh yeah checked my iStatPro widget on Ram .. i got 1.25GB of Ram Free**..

Cromulent
Aug 16, 2007, 05:22 PM
Never said Parallels was slow. It's actually quite responsive...

Yeah, I know you guys are telling me how it "just works" but I'm telling you how it doesn't. Notice how one is in quotes because it's from sort of commercial and the other is from real world experience.

Parallels won't start because it can't allocate the memory that mac has stored as inactive. To be clear, if I WIPE the inactive memory so it is FREE memory, I can start Parallels.

You have obviously allocated Parrelels too much RAM then. You should only really allocate 50% of your total RAM to Parellels (so in your case 2GBs). This is because you are running two operating systems at the same time and thus have to keep much more information in RAM at the same time.

I've been working with computers since I was 9, I'm now 24... I have worked with OSX since it came out. It needs to grow up. BUT this is NOT an OSX versus windows debate by any means. It has ONLY to do with the fact that everyone responds as if memory in OSX is always perfect 100% of the time and if it doesn't work it's user error.

It is a shame then that your massive experience is blinding you to the way computers actually work then isn't it?

As I said above all the RAM listed as inactive is still available to applications if they need it. It is swap that you need to be on the look out for.

Funny, since there's programs like Dust and IFreeMem...


*hint hint* Don't bust someone's chops repeating something they've read 4 times in the same post if they still say it doesn't work... Credit the user, not the wonder that is OSX. No wonder Apple is slow to patch open source vulnerabilities and have issues like this, the response to problems is drone in quality.

Saying something does not work, and something actually not working are two completely different things.

From the iFreeMem website

Inactive memory
This information is no longer being used and has been cached to disk, but it will remain in RAM until another application needs the space. Leaving this information in RAM is to your advantage if you (or a client of your computer) come back to it later.

What does all this mean?
This means you shouldn't worry when the Free memory is low. The only time Free memory should be high is right after the computer starts up. As you use applications or services, memory is used and transitions to Inactive. Applications that need more memory will take from the Inactive, but the Inactive is there just in case you need it again. If the combination of Free and Inactive is very low, then you might need more memory.


Funny how the very application you keep harping on about ¨proving¨ your point that OS X is bad at memory management says that you should have more inactive RAM than free RAM eh?

whydoyouwork
Aug 16, 2007, 05:28 PM
Wow...

1: I specified 512mb to Parallels... "Obviously" - Who even says something like that after I specified 512 in Parallels... Whats dedicated in the Parallels setup is 1gb, 512mb for the VM.
2: Explain Flash, Illustrator, Photoshop, Dreamweaver, Final Cut, etc, etc as far as not having enough memory goes...
3: I'm not saying if inactive is better than free, only that apps have proven to need Free ram when starting up, not inactive ram (which has been specific in this thread as allocated ram) which is where the bottleneck comes up... A bottleneck is a bottleneck, no matter what techincal docs say, no matter what Apple says, but only the fact that applications can't start when practically NOTHING is open.

Seriously, wow. You guys will get cocky, repeating exactly what others say, and go to lengths to say things like "obviously" and "blinding" when you don't even know me and all I'm doing is saying exactly what's happening to my machine... Still drone like responses only a personal jab, just like the commercials.

Oh the hilarity I'm finding in this thread... Leave it up to the guy that "believes in himself" to go beyond a stated fact and assume. This thread is getting out of control due to the fact that none of you guys simply can't say "nothing is perfect" or "odd behavior, it normally doesn't do that" but only "YOU'RE WRONG". This is just fun at this point. Someone quoting, insulting, all in the defense of something they had nothing to do with. Zealots around? And yes, this is me just toying with the situation.

Cromulent
Aug 16, 2007, 05:54 PM
Oh the hilarity I'm finding in this thread... Leave it up to the guy that "believes in himself" to go beyond a stated fact and assume. This thread is getting out of control due to the fact that none of you guys simply can't say "nothing is perfect" or "odd behavior, it normally doesn't do that" but only "YOU'RE WRONG". This is just fun at this point. Someone quoting, insulting, all in the defense of something they had nothing to do with. Zealots around? And yes, this is me just toying with the situation.

I see where you are coming from, but you have to understand when someone comes into a thread and claims (and I quote) The memory management is actually quite horrible.
you would understand why I'm quite keen to show that it is not.

One thing you fail to understand is that the memory management of OS X is handled by the Unix core, an operating system that has been in development for over 30 years and is used in a lot of mission critical environments. I would have thought that in all that time someone would have noticed poor memory management wouldn't you?

Now, you are obviously having a problem with your machine and I'll be happy to help resolve that problem if you explain exactly what the problem is.

2: Explain Flash, Illustrator, Photoshop, Dreamweaver, Final Cut, etc, etc as far as not having enough memory goes...

Which versions of these applications are you running? If you are running the CS2 versions (or earlier) of Photoshop, Flash and Illustrator and 5.0.4 (or earlier) of Final Cut Pro I can tell you exactly what your problem is. If not then I'll need more information.

3: I'm not saying if inactive is better than free, only that apps have proven to need Free ram when starting up, not inactive ram (which has been specific in this thread as allocated ram) which is where the bottleneck comes up... A bottleneck is a bottleneck, no matter what techincal docs say, no matter what Apple says, but only the fact that applications can't start when practically NOTHING is open.

Can you provide any extra information about the exact problems (error messages etc)? Console log file when you try and open the application in question would be good too.

whydoyouwork
Aug 16, 2007, 06:07 PM
Cromulent...

I'd be happy to pull logs. ON my day to day schedule i don't have time but when I get some free time on the MBP I def will. :D



I do understand the lineage of the memory management, but 30 years and nobody noticing a problem when it comes to the heaviest of hitting programs being multi tasked is not the same as a server scenario where Unix shines... It's just very very different. Again, I understand the lineage, the logic, etc. If anything, simply put, OSX doesn't dump the stuff it's allocated quickly enough in my experience (which is much more intense on the computer than the average user). In my day to day heavy use of computers I have seen that Windows (dare i say the word) does handle memory in a fashion that has yet to hold me back. I've never had the issue I have in OSX in Windows with the same amount of ram. In fact even less on a 32bit with 3.25gb of ram Windows install as well as 4gb in a 64bit install of Windows.

We can talk about how old Unix is (which makes me think if anything it never imagined the type of memory we have today when it was being created) and I DO respect it by all means. OSX is a good os, but as far as heavy multi tasking, I've never knew a fellow user that has gotten so defensive in light of something like memory management.

If my computer is messed up, alright, even that is bullocks considering I haven't done anything advanced and Apple controls both hardware and software at this basic level... But at least that is an answer, not an insult as other's have offered past repeating what they read somewhere else, showing little original logic.

swiftaw
Aug 16, 2007, 06:10 PM
I have had many apps running and never had a problem launching parallels on top of that. I would be leaning towards there being something wrong with your particular machine rather than a fundamental error in OSX's memory management

whydoyouwork
Aug 16, 2007, 06:12 PM
Except software and restart fixing the issue... Otherwise, I'd rule it out as well.

Also keep in mind the memory requirements of the programs I am talking about... It's not the number of apps, it's how intense they are...


And really, is it that hard to believe there is a flaw in the management? Or am I just delusional and should assume perfection?

m1ti
Aug 16, 2007, 08:40 PM
And really, is it that hard to believe there is a flaw in the management? Or am I just delusional and should assume perfection?

I think you are delusional. I run Photoshop and Illustrator CS3 on the same machine as you with 4GB ram and have no problems (except of course I would like 8GB to make it even faster).

I am not sure why you are complaining. Even if there is a memory problem, CS3 on Mac is faster than on PC; even the PC-centric CNET/ZDNet sites are saying it is.

http://reviews.zdnet.co.uk/software/contentcreation/0,1000001069,39286887,00.htm

whydoyouwork
Aug 16, 2007, 10:39 PM
Did I say it ran slower? I said OSX runs sluggish. Again, wow, words in my mouth, off topic, and using a generic term like "PC" that doesn't really mean anything these days. And operating system doesn't classify a mac as not a 'pc', it's still a personal computer, esp when it runs the same OS as the "pc".

The fact that people are just chiming in here, without any regard for the technical detail I posted thus far half the time... I don't really care if you run Photoshop and Illustrator CS3. Because I do, and I also run a bunch of other apps that I run on Windows and have no problem going back and forth...

Why do mac people always have this 'well it's good enough for me, it must be you' attitude like M1t1? And the reference to ZNET was NOT a good test. Running one app, on a different hardware setup than what we're discussing here, with nothing else major open... Hardly something to call someone delusional over. Except at this point delusional might stick because this has been a fun argument for me thus far.

So off topic at this point but still amusing. But I am done now. It must be my machine, osx is perfect for everyone, no matter what work load and never compared to any other operating systems. Sorry for even suggesting.

CanadaRAM
Aug 16, 2007, 11:03 PM
OK, we have 2 distinct camps here:

1) is the party who has multitasked OSX programs heavily for years and has never had an application force a restart for reason of not being able to reclaim Inactive memory to launch with. This party claims that OSX memory management is infallible, and anyone who claims they have a memory management problem with Inactive memory is on drugs.

2) is the party who experiences repeatable and serious memory problems with one specific program, declares that OSX memory management is flawed, and everyone who thinks it's OK just because they can use OSX programs flawlessly is living in a pipedream and should be very afraid.

Isn't it more likely that

1) Parallels, in one or more specific configurations, has a serious issue with OSX memory management, and
2) Virtually every other OSX program does not?

If we leave aside the merits of OSX memory management, and focus on the instance where there is failure, I would be curious to know why and how Parallels is behaving this way, and whether this is specific to this one machine, or a widespread problem. I have certainly never heard of another report similar to this with Parallels or any other program (although I have not done any searching, yet)

Eric5h5
Aug 17, 2007, 12:17 AM
I've been working with computers since I was 9, I'm now 24...

So? I've been working with computers longer than you and I'm older than you. Therefore I must be right. :rolleyes: Strangely enough, though, I've never had any issues with OS X's memory management and I haven't heard of anyone else who has either, until now. To claim that the memory management in a Unix environment is "horrible" and "for bloggers and students" is so silly that I have to question what you actually learned while supposedly working with computers for 15 years. Nothing technical, apparently....

--Eric

disconap
Aug 17, 2007, 12:31 AM
Wow...

1: I specified 512mb to Parallels... "Obviously" - Who even says something like that after I specified 512 in Parallels... Whats dedicated in the Parallels setup is 1gb, 512mb for the VM.

Based on my experiences with OS emulation (yes, I know all you Mac Geeks, Parallels and Virtual PC are different), you may be having a problem of just not enough RAM set aside for Parallels.

As far as memory management goes, there is one sure-fire test: try booting Parallels before you boot the rest and see if that makes a difference. If it does, than memory management is the problem. If not, then it's something else. Like...

2: Explain Flash, Illustrator, Photoshop, Dreamweaver, Final Cut, etc, etc as far as not having enough memory goes...

As I'm sure you know, Photoshop is an EXTREME memory hog. Try limiting the allocated memory to it to 50% or less, that may help.

3: I'm not saying if inactive is better than free, only that apps have proven to need Free ram when starting up, not inactive ram (which has been specific in this thread as allocated ram) which is where the bottleneck comes up... A bottleneck is a bottleneck, no matter what techincal docs say, no matter what Apple says, but only the fact that applications can't start when practically NOTHING is open.

Seriously, wow. You guys will get cocky, repeating exactly what others say, and go to lengths to say things like "obviously" and "blinding" when you don't even know me and all I'm doing is saying exactly what's happening to my machine... Still drone like responses only a personal jab, just like the commercials.

Oh the hilarity I'm finding in this thread... Leave it up to the guy that "believes in himself" to go beyond a stated fact and assume. This thread is getting out of control due to the fact that none of you guys simply can't say "nothing is perfect" or "odd behavior, it normally doesn't do that" but only "YOU'RE WRONG". This is just fun at this point. Someone quoting, insulting, all in the defense of something they had nothing to do with. Zealots around? And yes, this is me just toying with the situation.

Ok, look, you're likely to get a lot of attitude here, true. But much, much less than the Windows or Unix/Linux forums, I've found. And while 9-24 is pretty impressive, keep in mind some of us here are much older and have been working with computers since the same age (for me, that is 8-31, and I am HARDLY the oldest on here). Most of us want to help if we can, so just be patient and ignore the trolls. :)

CanadaRAM
Aug 17, 2007, 12:36 AM
As far as memory management goes, there is one sure-fire test: try booting Parallels before you boot the rest and see if that makes a difference. If it does, than memory management is the problem. If not, then it's something else.

I don't think that would be definitive.... the poster has already said that restarting the machine allows Parallels to launch with no problems -- the issue comes up apparently only after other OSX programs have been launched (or launched and closed Im not sure which), and the memory has been filled with inactive space. The OP says that, unlike every other OSX program which can commandeer the inactive memory automatically, their Parallels can not, and errors on launch.

It's unclear whether this is only while there are open OSX programs, or whether this still happens after all other OSX programs have been quit.

disconap
Aug 17, 2007, 12:38 AM
It's still unclear to me whether or not Parallels has been left running after boot/when problems arise or whether it is being loaded at that point. But you're right, it wouldn't be 100% conclusive (though better for diagnosing than the current information).

whydoyouwork
Aug 17, 2007, 01:12 AM
To be clear and stray from the "fun" side of this post...

1. 4gb ram.
2. Parallels is NOT the only application to tell me not enough ram. Parallels runs fine after boot or if there is FREE MEMORY for it, but NOT INACTIVE. Other programs follow this trend on my MCP.
Common programs running vary but not limited to Flash, Photoshop, Dreamweaver, Coda, Text Edit, Adium, Parallels, Transmission, Firefox, Safari, and After Effects.
3 .I am SPECIFICALLY trying to discuss OSX memory management and whether or not I have a problem, not Unix, whether that's where the core of the memory management came from, but what Apple has done to it since...
4. I never said I knew anything more than anybody else because I have been using computers since 9 and am now 24, I only used it as a reference to my base of knowledge. So whoever made a post just to make a negative out of that... If I am older than you in one way or another you just showed it.

And most importantly I have had MANY die-hard osx fans also complain that serious multi tasking is faster on Windows for most Mac models.

Seriously, why are people acting like knocking anything to do with OSX is like knocking their way of life... It's a computer, it's not perfect in the sense that it can never be perfect for 100% of people that ever use it. If you really think OSX is the end all be all of memory management since pretty much EVERYONE has not even hinted at something to be desired, come out to my apt in Chicago, use my computer while doing my daily tasks, then reboot into Vista and see how productive you are doing the same thing...

I wouldn't of even had fun with this post if I didn't get such backlash for suggesting, with logic, that the memory management is not perfect.

Anyhow, I hope the details clear thing up, since a lot of posters here love to assume and other things of that nature to prove a point rather than approach the simplest answer possible; OSX isn't perfect for every user and just because it's great for your 4 app multi tasking needs it should suite everyone else. I only say the latter part of the sentence because it is the reaction of almost every mac fan I have ever met, this forum being no different.

And again, I've been using OSX since it came out, just never as my main OS, always kept heavy hitting stuff in Windows, and per my user experience, I'm glad I did. I just finished putting Vista 64 Ultimate on the MacBook Pro and will be using that as my main OS... I know, crazy, Windows on a MacBook that has about 90% of the same internals of other, less crazed laptops out there... A full PC conversion if you will.

Crap, I ended up getting to the fun part of this post... Sorry. And yeah, i know, I said I was done, but then people posted logical statements.

As far as attitude, this is by far the most I've ever gotten in any forum... Windows users accept that it is not perfect and not due all to design but due to what it is capable of and what it has to consider as the largest spread OS in mainstream computers. Windows = GM and Apple = Lotus. Different companies with different products and should be assessed that way, only comparable when products are in the same arena, since the companies are not. There is a reason Apple is so hesitant to release OSX to the general public... Say bye bye to quick product development internally and quality control along with a bunch of other stuff. But with that in mind Apple zealots try to directly compare to justify how cool they seem to feel with a mac, despite it's imperfections, they will always insult, act dumb, or just not have an opinion in place of a upward pointed nose... Again, I'm talking about mac zealots here, not mac users.

CanadaRAM
Aug 17, 2007, 02:04 AM
The problem as I see it, WDYW, is that I (and I would guess most other respondents in this thread), have used Flash, Photoshop, Dreamweaver etc etc heavily just like you, with major multitasking, and have NOT run into the described error... even after (in my case just as one example) 24 days without rebooting. (just for fun, I opened 20 programs - all of the MS Office and Adobe CS2 suites plus others - 12 Gb of applications on my machine with 1.5 Gb RAM - still going strong no errors re: Inactive vs Free RAM)

As evidence, look at all the people who have posted their PageOut numbers ... where a large number of PageOuts guarantees that they have been running for weeks or months with little or no Free RAM.

So I am thinking, if you have continual problems along these lines, it is something specific to your setup, rather than a general failure of the OSX memory management.

Perhaps it is related to one of the programs or processes you habitually have open, or an interaction between two of them, I don't know (Transmission and Parallels or the combo of those two would be the first place I'd look). But I'm guessing it is not purely an OS problem.

If there was a systemic problem with releasing Inactive memory, then I would have expected to run into it myself, or have seen posts about it... but I haven't, not once.


As far as attitude, this is by far the most I've ever gotten in any forum.

Well, what you have posted runs counter to both the conventional wisdom AND the personal experience of the other posters here. If someone had said "The sun didn't come up today, everyone prepare for ruin and the end of the world." It may have been completely true for a resident of Castle Rock WA on May 19, 1980. But everyone else would look at their local conditions and argue the point vigorously.

Cromulent
Aug 17, 2007, 05:17 AM
The problem as I see it, WDYW, is that I (and I would guess most other respondents in this thread), have used Flash, Photoshop, Dreamweaver etc etc heavily just like you, with major multitasking, and have NOT run into the described error... even after (in my case just as one example) 24 days without rebooting. (just for fun, I opened 20 programs - all of the MS Office and Adobe CS2 suites plus others - 12 Gb of applications on my machine with 1.5 Gb RAM - still going strong no errors re: Inactive vs Free RAM)

Exactly my point, I can run the whole of Final Cut Studio and work away in Motion at the same time as doing things in Final Cut Pro and never have a sniff of an error. Sure it runs slightly slow seeing as I only have 2GBs of RAM but it still works.

As evidence, look at all the people who have posted their PageOut numbers ... where a large number of PageOuts guarantees that they have been running for weeks or months with little or no Free RAM.

Another good point. Most people here have uptime's on their computers of 10 days + most of the time. No problems with RAM allocation for myself.

It really would help me if you could post your logs so we can try and find the cause of your problems, rather than us just arguing back and forth over who has the worst attitude.

shamash
Apr 2, 2009, 12:14 PM
Sorry for the bump, but I have 12mb free ram and 2gigs inactive, and my computer is running hot and slow as ****. I'd like to switch these numbers around if possible, without paying for an app like ifreemem. Anyone have any ideas?

gcouger
Apr 5, 2009, 12:49 AM
Sorry for the bump, but I have 12mb free ram and 2gigs inactive, and my computer is running hot and slow as ****. I'd like to switch these numbers around if possible, without paying for an app like ifreemem. Anyone have any ideas?

It takes time to erase the handles to the programs in the RAM not in use. If you really want to clear it you have to write to each and every byte as well.

I can't see why there is any heat penalty from what is written to RAM. It costs no more in heat or time no matter what is written to it.

Before blaming the OS have a look at process table by opening a terminal window and running top and watch what is eating your memory. All the little widgets, gadgets and the junk hard drives and services install to run all the time come at price in memory and machine cycles. Just look up their names on Google and see what they do an how to get rid of them after you have a good back up or two.

There isn't a way to optimize a computer for every use. But I like Apple memory management system pretty well. When the first search on a data file takes 40 seconds and the second one less than 1 second for me they have it right.

Apps ported form Windows don't always fair so well. Some still suffer form left overs from the days of paged memory. The leftovers from workarounds to handle large data sets is still a ghost that haunts us in some of them.

After reading Apple has legacy code problems as well and probably old programmers with old ways don't help much either.
Gordon

zeeklancer
Apr 7, 2009, 12:39 AM
Sorry, I don't have time to read all of the post, but here goes.

It is likely that Parallels requires a contiguous memory chunk to run properly. Eg, it is not using virtual memory. But I don't know enough about how Parallels works, but if it were using a non virtual memory alloc it would likely have to have a kernel driver of some sort loaded.

In any case, the memory management is perfect in OSX!

I develop in OSX and use vmware with with multiple VE's running at a time with no problem. At any given time I have 4 to 8 gigs swap files going, and only about 3 to 10 megs free ram while working. It just works.

So, if you are having a problem then your install is busted and something hidden is taken your ram, or your ram is bad, or your computer is bad. But something is wrong, and it is not the OS.

-Zeek

wankeye
Apr 21, 2009, 04:04 PM
Wow, a whole lot of attempting to prove your case with anything other than "This OS is ****ing genius and it is DESIGNED to slow your computer down if you open up a lot of programs and then later only want to use 1!"

I was searching google for a way to clear my inactive RAM when I found this gem of a thread. Obviously, he is having a problem as such:

1) His computer has been on a while and then he closes programs and tries to load up a slightly memory intensive program (parallels fyi)

2) He understands the way in which the dazzlingly brilliant personal gift of god OS handles the memory, and will keep it around for you to quickly use it later, but when something else comes along it will quickly switch it for you.

3) Yet when he restarts his computer, now with his RAM freshly cleaned and unmolested by his ****** ram assignment methods that apparently he set in place and not the OS, nor by the multitude of porn videos he will watch later that day, his slightly memory intensive program (again, this is parallels fyi) opens easily!


What else are you guys saying happens when he restarts his computer besides his RAM getting cleared out?

Here is a quote from one of the articles you guys linked to but probably did not read.

"Paging Virtual Memory Out

The kernel continuously compares the number of physical pages in the free list against a threshold value. When the number of pages in the free list dips below this threshold, the kernel reclaims physical pages for the free list by swapping inactive pages out of memory. To do this, the kernel iterates all resident pages in the active and inactive lists, performing the following steps:

1. If a page in the active list is not recently touched, it is moved to the inactive list.
2. If a page in the inactive list is not recently touched, the kernel finds the page’s VM object.
3. If the VM object has never been paged before, the kernel calls an initialization routine that creates and assigns a default pager object.
4. The VM object’s default pager attempts to write the page out to the backing store.
5. If the pager succeeds, the kernel frees the physical memory occupied by the page and moves the page from the inactive to the free list."

The OS has to go through this list everytime before it frees up memory from the inactive store. Which, granted, is normally not a problem, in fact it is great when you are using finder a lot and surfing the web a whole bunch and just about most other things you do most of the time when you use a computer.

BUT, if you are done crapping around on the net for the time being, and you ain't planning on using finder or spotlight a lot, and you really don't care to look at those pictures you were just looking at again today, or etc..., then why the **** doesn't it make sense to want to wipe your inactive RAM so that loading up a program that is gonna be taxing on your system to make it run smoother??? You guys are ****ing insane if you can't stop, for one second, and just try to imagine that maybe everyone doesn't use a computer like you and their gripes could be legitimate. Maybe then we can have a rational discussion or something.

Thanks to anyone that actually recommended a program that would do what he wants, I will check these out now.

Consultant
Apr 21, 2009, 04:27 PM
I was searching google for a way to clear my inactive RAM ....

As been said, OSX does it. No need to do such a thing.

This is not windows. So what if one app from 2 years ago isn't optimized at the time? Parallels is a new product on the market. Probably changed since then.

People run for weeks at a time with a dozen apps open in OSX and DO NOT NEED any app to clear inactive RAM.

If you want to look for it anyway, try macupdate or versiontracker

wankeye
Apr 21, 2009, 06:38 PM
As been said, OSX does it. No need to do such a thing.

This is not windows. So what if one app from 2 years ago isn't optimized at the time? Parallels is a new product on the market. Probably changed since then.

People run for weeks at a time with a dozen apps open in OSX and DO NOT NEED any app to clear inactive RAM.

If you want to look for it anyway, try macupdate or versiontracker

Thanks for more of the same. The reason I only referred to parallels in the parenthesis is because I was referring to the fact that it could be any memory heavy app. I have had trouble with all sorts of apps, games especially. But anyway, if this is the way people are going to respond then don't bother, if you want to just ignore the fact that I have a problem, and tell me I don't have a problem, you are not helping and I don't care about your opinion.

Just to be clear: I don't care about whether it is the OS's fault or whether it is ****** programming in the app. If there is an easy way to clear out the RAM, that is all I am interested in.

Signal-11
Apr 21, 2009, 07:59 PM
Here is a quote from one of the articles you guys linked to but probably did not read.

"Paging Virtual Memory Out

The kernel continuously compares the number of physical pages in the free list against a threshold value. When the number of pages in the free list dips below this threshold, the kernel reclaims physical pages for the free list by swapping inactive pages out of memory. To do this, the kernel iterates all resident pages in the active and inactive lists, performing the following steps:

1. If a page in the active list is not recently touched, it is moved to the inactive list.
2. If a page in the inactive list is not recently touched, the kernel finds the page’s VM object.
3. If the VM object has never been paged before, the kernel calls an initialization routine that creates and assigns a default pager object.
4. The VM object’s default pager attempts to write the page out to the backing store.
5. If the pager succeeds, the kernel frees the physical memory occupied by the page and moves the page from the inactive to the free list."

The OS has to go through this list everytime before it frees up memory from the inactive store. Which, granted, is normally not a problem, in fact it is great when you are using finder a lot and surfing the web a whole bunch and just about most other things you do most of the time when you use a computer.

I think you misunderstand what's going on here. Yes, in a sense, this is what happens "each time" as you say, but this is NOT an additional step. The kernel does this as a CONTINUAL PROCESS with EACH PAGE IN PHYSICAL RAM. In other words, these are not steps 1-5, though it certainly could happen that way.

You generally don't need to clear inactive RAM because that RAM while not "free," is free to be called by any app. It doesn't speed up the process any for that RAM to be free instead of inactive because the pages are released as its called.

The differences between an app being allocated more memory from inactive or free is negligible because it starts by releasing memory to you that has ALREADY been cached to disk. It's not writing contents to the swap when it's being released. That would be incredibly inefficient.

There are no real apps to do this because if you're a guy who can write an app to do this, you also understand that it's not worth the time and the effort.

I'm sure there's some there's some outlier group that really needs this for some strange interaction but 99% of the time I have seen this question, it's because the questioner simply doesn't understand what it means.

wankeye
Apr 21, 2009, 09:40 PM
Hmm, okay I get what you are saying, but I guess I need to figure out what else it is that changes during a restart that makes running a game, or most anything else for that matter, run so much more smoothly. I downloaded ifreemem and am trying that out, so far it seems to have decreased the load time for certain things significantly, although I worry it is placebo.

Signal-11
Apr 21, 2009, 09:56 PM
Hmm, okay I get what you are saying, but I guess I need to figure out what else it is that changes during a restart that makes running a game, or most anything else for that matter, run so much more smoothly. I downloaded ifreemem and am trying that out, so far it seems to have decreased the load time for certain things significantly, although I worry it is placebo.

Hey, you could be one of these guys who does have a specific interaction. Don't know what's really going on in your computer, no one else here would.

I'm looking at iFreeMem's page and to be honest with you, I can't figure out exactly what it does nor how it actually improves anything.

Signal-11
Apr 21, 2009, 10:00 PM
There's several good explanations here:

http://www.tuaw.com/2008/02/21/ifreemem-2-0-when-you-just-dont-feel-like-rebooting/

Chase R
Apr 21, 2009, 10:35 PM
Oh Mylanta this is an old thread!

pesc
Apr 30, 2009, 01:41 AM
Look at it like this:

FREE memory is worthless memory. It's contents is useless for the system.
INACTIVE memory is more valuable. It is free memory with contents that the system knows what it is. If the contents are needed again, the memory is just there!

When an application needs more memory it can use either free or inactive memory. The costs are the same. The system DOES NOT have to first write the contents of inactive memory to the swap file before it can be used.

Because inactive memory is more valuable than free memory the system chooses to use free memory before grabbing inactive memory.

Here is a simple C program that nukes the cache in inactive memory and makes it free. When run, the program allocates a large amount of memory and writes to it so that it has to be allocated. All free and inactive memory is used up. When the program exits, all memory becomes free since the contents are unrelated to any VM object.

I would never use this program myself since it destroys the valuable inactive memory and converts it into worthless free memory. This degrades the performance of your system. But it might give some tinkerers and memory measurbators pleasure so here it is. Enjoy!

#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[])
{
int siz = (argc > 1 ? atoi(argv[1]) : 1024*1024)*1024;
void *p = malloc(siz);
if (p != NULL) {
memset(p, 1, siz);
memset(p, 113, siz);
}
}

Since the people worrying about free vs inactive memory obviously are advanced users they would have no problems figuring out how to compile and run this program.

The program takes the amount of memory to nuke as argument, measured in kB. To nuke about 1GB use
$ ./prog 1000000

Signal-11
Apr 30, 2009, 02:46 AM
As mentioned in that link even faster, in a terminal window:

du -k ~/ >/dev/null

Nrasser
Jul 29, 2009, 06:13 PM
There is one reason I have found to clear as much ram as possible.

I tend to use my MBP on irregular schedules, and have found that accidently leaving it sleeping in the case causes undesirable discharges of the battery; lots of extra wear and tear on an expensive part. I set it to hibernate on lid close instead...but then was waiting up to a minute or two for ram reload from disk on every startup.

iFreemem fixes that problem nicely, just run it before you put the machine away and the next time you use the machine it'll load up from hibernation in a few seconds.

I've also noticed that when running Parallels with VM's set for large memory sizes (~2gb), they tend to load up quicker if I run iFreemem first.

That said, I haven't seen any errors such as described earlier in the thread, at least not since switching to Leopard. I can run Parallels and Adobe stuff and the WoW client, browser, etc. etc. simultaneously with no resource conflicts (save for a bit of graphics slowdown). I have seen plenty of these errors in various versions of Windows.

xDiehardx
Aug 18, 2009, 07:13 PM
Computer specs:
Dual 1.8 GHz G5
1.5 GB DDR SD Ram.


Hey, so I've been having an issue with photoshop CS3. Im not sure if this has to do with inactive memory, or something completely different, but after reading all the posts it seems like it could be related?

This could be some sort of setting inside of OS X that I need to change. But I'm unsure what actually needs to be changed.

Ill be using photoshop for some large file (usually in the 250-700 MB area).

Once I'm done with the program I'll close it.

Now the next time I open photoshop, its super slow. Everything seems to be very sluggish to the point where even clicking on "File" or "Edit" menu, cause the computer to load for about 10 seconds. Im not even selecting anything from the menu, just bringing up the menu takes really long.

Nothing I can do can make this sluggishness go away unless I reset the computer. Then it works like a dream, until I close and reopen photoshop, then its messed up again.

Now don't get me wrong, I'm not bashing or blaming. I'm just curious to what setting I can possibly change to prevent photoshop from doing this sort of thing.

(I have no idea if this has anything to do with the inactive memory, or something completely different.)


Thanks in advance for any help on the subject.

iBookG4user
Aug 18, 2009, 07:17 PM
I think your problem is probably due to not having enough RAM, rather than inactive RAM. Open up Activity Monitor click on the system memory tab and then see how many page ins and page outs you have.

KingYaba
Aug 18, 2009, 07:59 PM
Additionally, you can use Disk Utility. Simply verify permissions.

Amdahl
Aug 18, 2009, 08:13 PM
Are you Quitting Photoshop, or just closing the window? It might make a difference.

xDiehardx
Aug 19, 2009, 06:25 PM
Alright, first off, on the activity monitor under Page IN/Out's:
After a few reboots and using of programs it seems the Page in is roughly 2x the page out. (540,000/263,000 etc.)

Secondly I've been quitting the program with file quit, or right clicking on the icon in the (docking bar i think?) and telling it to quit. Usually ill check the resource monitor to make sure photoshop is removed from the process list.

Third, I've tried repairing the hardrive's permissions. It repaired alot of permissions without issues, but that didn't help. When I tried to use the Repair disk option (from booting off the OSX Disk), I get the Volume Bit map needs minor repair issue error. After multiple attempts Disk Utility cant get around or fix it.

I've been looking around alot on this issue, and apparently its very vague what causes this error. On top of that the only solution I can find, seems to be buying a $100 application, from what I've read, only sometimes works.

Would a volume bit map issue cause this kind of performance killing?


My major issue is this is the computer where I work, so I cant spend hours upon hours messing around with settings like I can on my home PC. Also, since money is tight, convincing my boss to spend $100 on something that "might" work, is also outa the question. Especially when it may not even be the solution to the extreme slowdown.


A little further on the ram issue. 1.5 gigs of ram definitely isn't anywhere near what I'd like to see, but when the only application I'm running is photoshop, it should be enough to get by. I've had Photoshop CS3 run just fine on my old cup holder at home (P4 1.5ghz - 1gig of ram)

Also, not having quite enough ram on photoshop should only really slow down the time required to complete certain tasks. It doesn't explain how the computer is extremely slow when I don't even have a file in photoshop open. Photoshop running, with no files open within it, "shouldn't" cause a complete slowdown to the point where it takes 10+ seconds for the the File menu to open up. (Other things like safari, the docking bar, dashboard also become extremely unresponsive).

Also I've read up on safari having some major memory leak issues, so just to clarify I don't keep it running in the background. I also have no gadgets or apps running (other then what's on by default with OSX install)



Sorry for going on so long! lol. Just trying to leave enough info for people to work with.

Again, ,major thanks in advance for any help.

lisamariet
Sep 6, 2009, 04:20 AM
I am also having problems with my MacBook pro running slowly when opening new apps and I am having little free ram.

I really wish my MAC would be fast all the time just like it was in the beginning... but it is not any more. It is weird really... as I understand what has been explained on how the memory works on MAC... Unfortunately it does not run very smoothly on my MAC. I am pretty sure that it has to do with t he programs I am running.

However... maybe someone could explain more about the page outs and page ins? I looked in my Activity Monitor and it currently says:
VM size: 50.78 GB
Page ins: 174.62 MB
Page outs: 16.92 MB
Swap used: 9.41 MB

Free: 10.40 MB
Wired: 442.81 MB
Active: 676.81 MB
Inactive: 2.90 GB

So according to the cake diagram currently 3/4 of my system is inactive memory right now.

(I have 4GB of RAM installed)

And I just did a reboot. Then started up Safari and Firefox, and off course Activity Monitor. There is a couple of other services I have installed too: Microsoft Live Sync, LogMeIn, QuickSilver and EverNote. Other than that everything should be standard.

I use VMWare Fusion and I would not dream to open up a VM now as I know by experience it will be insanely slow and slow down my entire MAC. Because of this I have stopped using VM's and also stopped using my MAC for work as it is too slow and unusable. However I find that it gets slow anyways... even from just normal lite usage like.. playing music, looking at pictures, using chat clients. Then suddenly it will become very slow. I find that Firefox is using a lot of virtual memory (over 1 GB) and I suspect that he is the cause of memory problems. So if I do want to use my VM image I must be sure NOT to have firefox opened... neither Flock which I also used occasionally. In the beginning I would have both firefox and Flock opened at the same time and everything was quick and fantastic. If I try that now... forget it... it will take like 10-15 minutes before they are both opened and that I can actually use the MAC for anything... and it will be very very slow.

So I already know that Firefox and Flock are huge memory huggers. so no need to tell me that. So because I know this I often close them down.. Quiting... before I open something else up... however I still find my MAC to be slow.. not AS slow as if I had them open, but still... slow. Slower than it was in the beginning when I got it.

zgtuner
Nov 18, 2009, 04:51 PM
Unbeliveable!!!! This discussion is going for years as I can see.

Some guys saying that Mac simply slowes down and does not perform, and
other "clever" guys telling the tales about how it SHOULD be.

Don't they understand that it is not as it should be in many cases.

The system simply does not release inactive memory when this is required. Full stop.
And what is design doing to improve this all this years.....

What a shame that I have to read from forums like this what does it mean wired and what does it mean inactive. No singe word about it on Mac user guides.

Try search on Macc webpage on "what is wired memory"
and you will get response
do you mean "what is weird memory".....
Hi Hi .. congratulations

Be happy



I am also having problems with my MacBook pro running slowly when opening new apps and I am having little free ram.

I really wish my MAC would be fast all the time just like it was in the beginning... but it is not any more. It is weird really... as I understand what has been explained on how the memory works on MAC... Unfortunately it does not run very smoothly on my MAC. I am pretty sure that it has to do with t he programs I am running.

However... maybe someone could explain more about the page outs and page ins? I looked in my Activity Monitor and it currently says:
VM size: 50.78 GB
Page ins: 174.62 MB
Page outs: 16.92 MB
Swap used: 9.41 MB

Free: 10.40 MB
Wired: 442.81 MB
Active: 676.81 MB
Inactive: 2.90 GB

So according to the cake diagram currently 3/4 of my system is inactive memory right now.

(I have 4GB of RAM installed)

And I just did a reboot. Then started up Safari and Firefox, and off course Activity Monitor. There is a couple of other services I have installed too: Microsoft Live Sync, LogMeIn, QuickSilver and EverNote. Other than that everything should be standard.

I use VMWare Fusion and I would not dream to open up a VM now as I know by experience it will be insanely slow and slow down my entire MAC. Because of this I have stopped using VM's and also stopped using my MAC for work as it is too slow and unusable. However I find that it gets slow anyways... even from just normal lite usage like.. playing music, looking at pictures, using chat clients. Then suddenly it will become very slow. I find that Firefox is using a lot of virtual memory (over 1 GB) and I suspect that he is the cause of memory problems. So if I do want to use my VM image I must be sure NOT to have firefox opened... neither Flock which I also used occasionally. In the beginning I would have both firefox and Flock opened at the same time and everything was quick and fantastic. If I try that now... forget it... it will take like 10-15 minutes before they are both opened and that I can actually use the MAC for anything... and it will be very very slow.

So I already know that Firefox and Flock are huge memory huggers. so no need to tell me that. So because I know this I often close them down.. Quiting... before I open something else up... however I still find my MAC to be slow.. not AS slow as if I had them open, but still... slow. Slower than it was in the beginning when I got it.

theshadow27
Dec 10, 2009, 07:12 PM
I've read through this thread and don't want to get wrapped up with the argument of how amazing Apple/BSD is with managing memory. Fact is that I have a 17" unibody MBP and when Safari has been running 30-40 tabs for a few days it doesn't release memory properly when it closes. I have 8gb so it's not usually a problem, but if I'm running VMware (2gb) with NetBeans (2gb) and Safari (2-3gb) then it gets a little tight.

From my informal tests, the system is more responsive when running with "Free Memory" than "Inactive Memory." As a computer scientist and electrical engineer to me the reason for this is fairly straight forward. When the Kernel has free memory to work with, it can allocate it without thinking. When it's inactive memory, no matter how fast/efficient/wonderful the MMS is, it still has to page out that data. What "clearing the inactive ram" means to me is:
Forcing the Apple MMS to preemptively page inactive memory to disk so it is not done at the time of allocation.

Now that that's out there, here's how I did it. It's in two parts, mostly because I'm rusty at C and found a ruby program that didn't work. Here's the C++:


#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <string>
using namespace std;

int main (int argc, char * const argv[]) {
if(argc <2){
std::cout << "Must specify size in bytes\n";
return 1;
}

// allows full memory space usage
long size, i, ints;

// size in bytes, parsed from the int
size = atoll(argv[1]);
// calculate the number of unsigned ints this will occupy
ints = size / sizeof(unsigned int);
// give a nice value printout
std::cout << "Allocating "<< size << " bytes ("<<ints << "ints)\n";

// allocate the memory
unsigned int* mem;
mem = (unsigned int*) malloc(size);

// in OS X you have to use it for it to count
for (i=0; i<ints; i++) {
mem = rand();
}

// free it up.
free(mem);
return 0;
}

This code allocates a certain number of bytes of live memory (passed in as an argument) and fills it with random numbers. It then frees it properly with the "free()" call (which, by the way, Safari 4.0.4 does [i]not do).

The next part I admittedly stole most of from here (http://forums.macosxhints.com/archive/index.php/t-31057.html). It's just a Ruby script to read in the results from "vm_stat" and figure out how many bytes to malloc. There's a few reasons that it's not all in Ruby, (1) because the Ruby version was very slow and (2) because it didn't work with 10.6 (don't know about whatever 10.x was in 2006). So my version of the shell script just calls the above executable:


#! /usr/bin/ruby

puts "Beginning inactive memory free routine"

vm_stat = `vm_stat`

vm_stat = vm_stat.split("\n")

page_size = vm_stat[0].match(/(\d+) bytes/)[1].to_i

pages_free = vm_stat[1].match(/(\d+)/)[1].to_i
pages_inactive = vm_stat[3].match(/(\d+)/)[1].to_i


bytes_to_read = page_size*pages_free + page_size*pages_inactive

puts "Free pages: " + pages_free.to_s
puts "Inactive pages: " + pages_inactive.to_s
puts "Allocating bytes: " + bytes_to_read.to_s + " (" + (bytes_to_read/(1024*1024*1024.0)).to_s + "gb)"

cmd = "allocate " + bytes_to_read.to_s
system(cmd)

sleep(3)

vm_stat = `vm_stat`.split("\n")
pages_inactive = vm_stat[3].match(/(\d+)/)[1].to_i
puts "All done. Now there are " + pages_inactive.to_s + " inactive pages."


I compiled the C++ in a file called "allocate.cpp" (executable was just "allocate" - created using an XCode project although you could probably do it with gcc) and the ruby is in "inactive.sh". When I close a program and want to get rid of the blue, I just run "inactive.sh". I've attached the XCode project and the Ruby script with the hope that it saves someone the trouble. Cheers,

JSD

vhato
Jan 18, 2010, 08:25 AM
I've read through this thread and don't want to get wrapped up with the argument of how amazing Apple/BSD is with managing memory. Fact is that I have a 17" unibody MBP and when Safari has been running 30-40 tabs for a few days it doesn't release memory properly when it closes. I have 8gb so it's not usually a problem, but if I'm running VMware (2gb) with NetBeans (2gb) and Safari (2-3gb) then it gets a little tight.

From my informal tests, the system is more responsive when running with "Free Memory" than "Inactive Memory." As a computer scientist and electrical engineer to me the reason for this is fairly straight forward. When the Kernel has free memory to work with, it can allocate it without thinking. When it's inactive memory, no matter how fast/efficient/wonderful the MMS is, it still has to page out that data. What "clearing the inactive ram" means to me is:
Forcing the Apple MMS to preemptively page inactive memory to disk so it is not done at the time of allocation.

Now that that's out there, here's how I did it. It's in two parts, mostly because I'm rusty at C and found a ruby program that didn't work. Here's the C++:


#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <string>
using namespace std;

int main (int argc, char * const argv[]) {
if(argc <2){
std::cout << "Must specify size in bytes\n";
return 1;
}

// allows full memory space usage
long size, i, ints;

// size in bytes, parsed from the int
size = atoll(argv[1]);
// calculate the number of unsigned ints this will occupy
ints = size / sizeof(unsigned int);
// give a nice value printout
std::cout << "Allocating "<< size << " bytes ("<<ints << "ints)\n";

// allocate the memory
unsigned int* mem;
mem = (unsigned int*) malloc(size);

// in OS X you have to use it for it to count
for (i=0; i<ints; i++) {
mem = rand();
}

// free it up.
free(mem);
return 0;
}

This code allocates a certain number of bytes of live memory (passed in as an argument) and fills it with random numbers. It then frees it properly with the "free()" call (which, by the way, Safari 4.0.4 does [i]not do).

The next part I admittedly stole most of from here (http://forums.macosxhints.com/archive/index.php/t-31057.html). It's just a Ruby script to read in the results from "vm_stat" and figure out how many bytes to malloc. There's a few reasons that it's not all in Ruby, (1) because the Ruby version was very slow and (2) because it didn't work with 10.6 (don't know about whatever 10.x was in 2006). So my version of the shell script just calls the above executable:


#! /usr/bin/ruby

puts "Beginning inactive memory free routine"

vm_stat = `vm_stat`

vm_stat = vm_stat.split("\n")

page_size = vm_stat[0].match(/(\d+) bytes/)[1].to_i

pages_free = vm_stat[1].match(/(\d+)/)[1].to_i
pages_inactive = vm_stat[3].match(/(\d+)/)[1].to_i


bytes_to_read = page_size*pages_free + page_size*pages_inactive

puts "Free pages: " + pages_free.to_s
puts "Inactive pages: " + pages_inactive.to_s
puts "Allocating bytes: " + bytes_to_read.to_s + " (" + (bytes_to_read/(1024*1024*1024.0)).to_s + "gb)"

cmd = "allocate " + bytes_to_read.to_s
system(cmd)

sleep(3)

vm_stat = `vm_stat`.split("\n")
pages_inactive = vm_stat[3].match(/(\d+)/)[1].to_i
puts "All done. Now there are " + pages_inactive.to_s + " inactive pages."


I compiled the C++ in a file called "allocate.cpp" (executable was just "allocate" - created using an XCode project although you could probably do it with gcc) and the ruby is in "inactive.sh". When I close a program and want to get rid of the blue, I just run "inactive.sh". I've attached the XCode project and the Ruby script with the hope that it saves someone the trouble. Cheers,

JSD

It seems we are on the same page and from your message it appears you have an application that can free inactive ram.

I just wish I knew how execute it.

ctt1wbw
Jan 18, 2010, 08:30 AM
I just use a magnet from a speaker.

theshadow27
Jan 18, 2010, 10:36 AM
It seems we are on the same page and from your message it appears you have an application that can free inactive ram.

I just wish I knew how execute it.

No offense intended, but if you're unsure how to run a C++ program you probably shouldn't mess with this. Allocating massive amounts of RAM (how the program works) is inherently unsafe and can absolutely crash your computer.

If you're sure you want to try anyway, and accept the liability of potential damage:
1) Save the first program as UTF-8 in TextEdit.app to some folder as a file called "inactive.cpp".
2) Using Terminal.app, navigate to the folder that you saved ("cd" to change directory, etc...) and type "cc -o inactive inactive.cpp" (return)
3) Save the second program as UTF-8 in TextEdit.app to something like "inactive.sh" in the same folder as the original
4) Using Terminal.app (in the same folder as before) type "chmod 755 inactive.sh" (return) to set the script executable.

To run the program, from Terminal.app just run "./inactive.sh" (return)

I just use a magnet from a speaker.
Funny. Unfortunately that stopped working when I got the 256gb SSD :rolleyes:

theshadow27
Jan 18, 2010, 10:42 AM
On a side note - I haven't had to use this since 10.6.2 pushed. They fixed something, Safari is behaving much better. I still have to quit every 8 hours or so when it gets up to 1200MB active, but at least it cleans up after itself now.

ghostlines
Feb 3, 2010, 12:39 PM
I understand the MMS's reason for storing inactive RAM. But I believe it's a fact that if free RAM is low, opening new apps goes terribly slow, and the system feels sluggish at times. So the MMS idea is good but some how it's not releasing inactive RAM fast enough(or just isn't) to open new apps.

This is annoying to users who have alot of RAM, and in particular alot of inactive RAM lying around doing "nothing".

I think appropriate thresholds should be in place to set a maximum amount of allowed inactive RAM based on the total amount of RAM and whatever other needed variables.

theshadow27
Feb 3, 2010, 01:04 PM
I understand the MMS's reason for storing inactive RAM. But I believe it's a fact that if free RAM is low, opening new apps goes terribly slow, and the system feels sluggish at times. So the MMS idea is good but some how it's not releasing inactive RAM fast enough(or just isn't) to open new apps.

This is annoying to users who have alot of RAM, and in particular alot of inactive RAM lying around doing "nothing".

I think appropriate thresholds should be in place to set a maximum amount of allowed inactive RAM based on the total amount of RAM and whatever other needed variables.

Unfortunately there is no way to do this accurately with programs written in C/C++ derived languages (like OS X, and the majority of the applications that run on it). Such languages have origins before multi-thread capable systems, where it was desirable for a program to use as much memory as it required. Thus they were designed so memory is allocated programmatically using statements like "malloc" before use, and freed with statements like "free." The computer does not, and can not, keep track of what memory is actually being used - that responsibility lies solely with the application. This was not an issue when the computer reset the whole memory space between jobs, but has created a few problems today.

What we see displayed as "active" and "inactive" memory is just an estimation based on time of last access. This is a primitive technique from the early days of paging to increase cache hit efficiency. "Inactive" memory just means that the data stored there has not been accessed within the last N cycles.

The only way around this problem is using an exact garbage collection scheme, such as implemented within the Java JVM. In this system, the programmers no longer have to allocate memory, or guess when it's being used; the garbage collector takes care of it automatically. In an exact GC setup, the machine knows exactly which memory can be used again and which can not, and thus occasionally but regularly returns the inaccessible memory to a common pool.

While garbage collection schemes exist for C-type languages, they are conservative collectors - they don't know where all memory pointers are located. They can often do a better job than the programmers themselves, but are nowhere near as efficient as the exact collectors. Without a full picture of the program code AND the memory it uses, they err on the conservative side - leaving memory allocated.

So basically as long as OS X is written in C, we will have to deal with inactive memory. There are no thresholds or variables to tinker with, the information just isn't there.

ghostlines
Feb 3, 2010, 02:23 PM
Unfortunately there is no way to do this accurately with programs written in C/C++ derived languages (like OS X, and the majority of the applications that run on it). Such languages have origins before multi-thread capable systems, where it was desirable for a program to use as much memory as it required. Thus they were designed so memory is allocated programmatically using statements like "malloc" before use, and freed with statements like "free." The computer does not, and can not, keep track of what memory is actually being used - that responsibility lies solely with the application. This was not an issue when the computer reset the whole memory space between jobs, but has created a few problems today.

What we see displayed as "active" and "inactive" memory is just an estimation based on time of last access. This is a primitive technique from the early days of paging to increase cache hit efficiency. "Inactive" memory just means that the data stored there has not been accessed within the last N cycles.

The only way around this problem is using an exact garbage collection scheme, such as implemented within the Java JVM. In this system, the programmers no longer have to allocate memory, or guess when it's being used; the garbage collector takes care of it automatically. In an exact GC setup, the machine knows exactly which memory can be used again and which can not, and thus occasionally but regularly returns the inaccessible memory to a common pool.

While garbage collection schemes exist for C-type languages, they are conservative collectors - they don't know where all memory pointers are located. They can often do a better job than the programmers themselves, but are nowhere near as efficient as the exact collectors. Without a full picture of the program code AND the memory it uses, they err on the conservative side - leaving memory allocated.

So basically as long as OS X is written in C, we will have to deal with inactive memory. There are no thresholds or variables to tinker with, the information just isn't there.

I understand the limitations you mentioned concerning garbage collection. But to my understanding of earlier posts in this thread and this link http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ManagingMemory/Articles/AboutMemory.html is that OS X stores inactive memory so that if you reopen an app recently used it can launch quicker.

I don't think that as long as OS X is written in C we have to deal with this problem. The MMS scheme could maybe be altered to allow closed apps to free their memory so other apps can use it much quicker. Having more ram on a system means that more apps can be ran simultaneously without/with less slowdown.

The MMS scheme that OS X uses(by saving app data in mem to let them reopen quicker) doesn't allow you to run the same amount of apps, and same group of apps, at the same time with the same "snappiness"/response time.
The speed of my system i.e. user experience shouldn't be dependent on the order in which I run a specific group of apps.

For example I have 4gb RAM total, and I allocate 1 gig to my VM. My freemem was 45mb's and inactive was 2.04gb at the time. It took the system very long to start up VMware and then the VM. Because the system took too much time releasing 1 gig of inactive memory that could of been free in the first place.

Imo the system should only struggle when I'm swapping memory, when reaching the limits of my total physical memory. And according to link they're thresholds that certain activities are based on.

micronuts
Feb 18, 2010, 12:28 AM
Honestly, you don't need to worry about the inactive RAM. OS X handles memory much better than Windows. When you open a new app that requires memory, OS X will switch out the inactive RAM in the background. Unless you have oodles of RAM and very few applications open, you'll generally find you have less than 100MB free. OS X will use as much as it can whenever possible but since it's good at the inactive stuff, you shouldn't notice too much.

Those widgets are taking up quite a bit of RAM but that's probably more to do with the way in which they're coded. You could close them if it bothers you and reopen them.

I have to disagree.

For the last two years my macbook os x tiger was performing flawlessly with great response. In the last two months I've noticed the following applications loading slowly

- FF
- Safari
- Mail
- Moodex

Well, almost every app.

So I started checking memory usage. And the common factor is that free memory came right down to a few k, from 300K or so, and INACTIVE memory staid the same! Upwards of 300K.

So what do you think is causing this slowdown!? When I close a few apps, like Safari, Mail, then free memory goes back up to 300K or so (I have over 1Gb of RAM), but inactive memory is still quite high.

Please explain.

js

vinayakaya
Mar 10, 2010, 06:48 PM
I have to say, this thread is the perfect example of the infamous fanboy syndrome. Claiming that Macs have great memory management and that the way it deals with inactive memory is "how it is supposed to be" is just ludicrous.

I have 4 gigs of memory, and by the end of any given day my memory is full, and shutting down all major software does NOT free that memory. This is NOT good memory management! In fact this implies serious memory leaks.

I wish people would stop making a computer company into their religion and deal with the real problems that do exist in this OS.

Yes it is better than microsoft, but if it wants to maintain that advantage then they can't afford to ignore its shortcomings. Furthermore if Mac fanboys want to maintain any shred of credibility then they have to be objective and stop defending Apple unconditionally.

PS. To make the point clearer, I installed that program ifreemem that someone mentioned on this post and it freed up 2 gigs of memory! You could take this as praise to the ifreemem software, but in reality it should send a message loud and clear to Mac and the fanboys : Mac memory management can and should be improved!

anand.mundewadi
May 28, 2010, 01:33 AM
I am facing problem when i am exicuting programs with xCode. if anyone knows problems regarding Flock files

dyn
May 30, 2010, 08:25 AM
I have to say, this thread is the perfect example of the infamous fanboy syndrome. Claiming that Macs have great memory management and that the way it deals with inactive memory is "how it is supposed to be" is just ludicrous.

This thread is the perfect example of a lot of people not understanding memory management at all. There are exceptions because some people actually care to explain the details of memory management where they also point out that there are indeed some problems with it. However everybody who understands memory management does agree on one thing: it IS supposed to work like that. That still doesn't mean it is the right way of doing it as you can clearly tell by the discussion about whether the way it is supposed to work is the right way of doing it. Your post is rather ludicrous.


I have 4 gigs of memory, and by the end of any given day my memory is full, and shutting down all major software does NOT free that memory. This is NOT good memory management! In fact this implies serious memory leaks.

No it doesn't. It's part of how the memory management works: it keeps things in memory. There are some problems where not all of the memory is regained by other software. Memory leaks would be something differently: Firefox has had some of those in the past. Firefox took up a lot of memory when you fired it up and kept eating memory when it was running. That is memory leaking. It was easy to resolve: quit Firefox.

In the end it's about being able to run software properly. I have memory filled up most of the time but in my 4 years of using a Mac I haven't had any memory related problems other than a defective memory module (it caused kernel panics). The Macs were as fast as when I had just booted them. I'm always using the sleep function, it was actually one of the main reasons for getting a Mac.

Too bad there are still people who only judge things by their specs and the amount of free memory instead of the overall performance of the device. In the end it's not the specs and not the amount of free memory that counts, it's what the machine does with it. You absolutely fail in every aspect regarding the overall performance. You fail to research what the amount of free memory and the amount of inactive memory does for your performance. Luckily there are other people in this thread who did research like that and posted their results. I'd rather read their posts as they are informative and just a flame like yours obviously is. You don't point out why memory should be released after a program stops running.


I wish people would stop making a computer company into their religion and deal with the real problems that do exist in this OS.

I wish people like you would indeed stop doing that and stop spreading false information. As you can tell in this thread a lot of people have showed why it works the way it works and that there are some flaws. That quite shows the opposite of "hear no evil, see no evil". There is absolutely no reason for flaming.

theshadow27
May 30, 2010, 09:20 AM
Too bad there are still people who only judge things by their specs and the amount of free memory instead of the overall performance of the device.

I'm sorry, in case you missed it I've run performance tests with Safari, NetBeans, and VMWare fusion with all free vs. all inactive memory, and all three programs started and ran faster with free memory.

Since my post last year discussing a C program for clearing cached (inactive) memory, I've found a commercial product ( Activata iFreeMem (http://www.activata.co.uk/ifreemem/) ) that does the same thing with a GUI. If this was not an issue, and the "problem" was in our imagination, why would a company develop a product to provide a solution? Hint: it's not "because there's profit in people's ignorance."

I have been using the Activata product for a few months now and am very happy with it. Especially during the VMWare Fusion 3.1 beta, when they cached large (several gigs in some cases) performance metrics and debugging information, running a VM with 2GB of virtual memory would end up taking 6GB physical. If you quit VMWare, this became inactive memory, and opening a different VM would take 200-300 seconds. Freeing inactive ram via iFreeMem takes about 15 seconds, and launching a VM with all free memory takes about 25 seconds. The reasons for this are discussed elsewhere in this thread.

dyn
May 30, 2010, 05:40 PM
I'm sorry, in case you missed it I've run performance tests with Safari, NetBeans, and VMWare fusion with all free vs. all inactive memory, and all three programs started and ran faster with free memory.

Since my post last year discussing a C program for clearing cached (inactive) memory, I've found a commercial product ( Activata iFreeMem (http://www.activata.co.uk/ifreemem/) ) that does the same thing with a GUI. If this was not an issue, and the "problem" was in our imagination, why would a company develop a product to provide a solution? Hint: it's not "because there's profit in people's ignorance."

That's the most stupid question to ask since there an awful lot of applications out there that do nothing and yet you have to pay for it. A lot of tweaks you can do in the terminal are free but some people create an app and charge you for it. There are also quite a lot of products that simply resell an existing free product. This happened to OpenOffice.org. Also, there are quite a lot of pieces of malware that pretend to be malware removers and require you to pay for them. So why do companies create such products? Well, because they think they can make a profit or help people with it. So yes, there is profit in people's ignorance, quite a lot actually but it is not the only thing.

Again, as you've pointed out earlier the way OS X's memory management works is how it is supposed to work but it is flawed. As you've showed it is not always capable of freeing up the memory properly. And there is exactly the difference people need to see: "supposed to work" does not say anything about how well it works! You could also view it from another angle: by the way it is implemented it works how it's supposed to work but the implementation is wrong. It's expected behaviour but it is wrong behaviour.


I have been using the Activata product for a few months now and am very happy with it. Especially during the VMWare Fusion 3.1 beta, when they cached large (several gigs in some cases) performance metrics and debugging information, running a VM with 2GB of virtual memory would end up taking 6GB physical. If you quit VMWare, this became inactive memory, and opening a different VM would take 200-300 seconds. Freeing inactive ram via iFreeMem takes about 15 seconds, and launching a VM with all free memory takes about 25 seconds. The reasons for this are discussed elsewhere in this thread.
I don't notice anything of this. Fusion has been snappy since version 1 for me and it still is in version 3.1. Vm's open very quickly, resume and suspend quickly and the performance of the vm's doesn't degrade over time. Virtualisation apps are a bad example to use when you're talking about memory, especially VMware products. VMware not only uses RAM but it also uses the disk. VMware Fusion benefits from a lot of RAM but it also benefits from a fast disk like a ssd. Virtualisation applications also need to handle memory differently, it makes it a bit more complex. Using Fusion as an example is wrong for several reasons: it has had memory bugs in the past, it has had performance bugs related to things like virusscanners, the vm library, spotlight, etc. There are just too many variables with Fusion that could cause performance problems. You really need a testing procedure and run it several times.

Btw, the debugging option is in the beta, rc and final release of the product. You can disable it in the preferences. Once you disable it, it stays disabled no matter what version you're running (I've set this in 3.0 on this Mac and it stayed that way through the 3.1 beta cycle and the final version). When running into problems you can gather information and turn the debugging on.

On my Macs I haven't seen any application actually run faster with a lot or little to no free memory. They've always ran at the same speed. However I've noticed that starting up the application is a lot faster when they've already ran. VMware Fusion and OpenOffice.org seem to startup noticeably faster when you fire them up for the second time. It's possible that there are speed differences when running synthetic benchmarks but that's not really a good way of testing it because it is nowhere near reality. Judging by the fact there aren't posts all over the internet screaming OS X has a memory problem I don't think I'm the only one.

There are some things I don't see in this thread: memory management is different when using 64 bit which is common with the new Macs and with Snow Leopard. I don't see this taken into account. The same thing goes for memory leak bugs in the applications itself. Firefox, Safari and VMware Fusion are examples of applications that have or have had such bugs. Some applications can not release their memory properly due to some bug in their code. In this case it's obviously not an OS bug. Virtualisation handles memory a bit differently as well, I don't see this being mentioned in this thread either. This is especially important with VMware products since they use the disk for some memory management as well. Not everything gets pushed into the RAM. I also don't see anyone writing down a testing procedure nor do I see anyone running the test several times to check if the figures are coincidence or if they are not. This makes judging the results posted here really hard, you simply can not tell how you should read the figures and what they mean. To me they're just numbers. Just because I know OS X does have problems regarding memory management, I know people aren't making things up.

monkeyvn87
Oct 5, 2010, 11:32 PM
I have 4gb of ram in the latest (August 16th, 2007) MacBook Pro...

The memory management is actually quite horrible. At times I have 2gb of inactive memory... Even after I close down evertyhing but adium I still cannot get the space back.

So say I'm working rather quickly in Flash, Illustrator, and Dreamweaver while testing in Firefox and I need to start Parallels to load my bootcamp Partition of Windows with 512mb ram to test something in I.E... I have to restart, even if I close all the apps, it doesn't clear nearly enough memory...

This is my first time running OSX more than Windows in a development/design atmosphere... It manages memory worse than Windows when it comes to something like that. When 4gb and a 200gb hd aren't enough for proper multi tasking that I do on my windows machine at home without a hitch isn't enough... You're memory management is made for bloggers and students.

If anyone is wondering Vista flies on the MacBook Pro 17'. OSX is sluggish in comparison.

To clear memory, look up Dust on MacUpdate.com


To answer someone's question, "Do you think Apple would be that stupid?" Yes.


Your mom and your dad didn't teach you about modesty, did they?

Chase R
Oct 6, 2010, 03:07 AM
Ok, we all know that inactive memory is there for a reason. Apple says it is there so for an application to access, even though it isn't currently in use, before it has to go to the HDD and seek it. This is true, HOWEVER...

That doesn't dismiss the MANY, if not countless, claims that when a person's RAM is full of inactive memory, there system runs slower.

I've experienced it, as has lots of people I've talked to.

The process of allocating memory to "free" RAM opposed to replacing "inactive" RAM with another application is not the same. OS X slows down when dealing with large amounts of inactive memory. Anyone who argues that is either ignorant and unobservant or an Apple fanboy.

My system, as many OS X systems I've tested, operate much faster when there is an abundance of "free" memory opposed to a system that is stuffed full of "inactive" memory.

Stresspuppy
Nov 2, 2010, 08:14 PM
The reason that things are slow when the inactive memory is high is that when the system can't get memory, it starts swapping out to disk. HDD is EXTREMELY slow compared to RAM so you see a slow down. I have seen my 4gb Macbook Pro use 2-3 gb of swap space and I just have to shut everything down and reboot.

I tried the program mentioned above (iFreeMem) and it seems to do exactly what it says. However, what was swapped out to HDD seems to stay there so I have 550mb in swap but 2 gb of Free memory. So what the heck does it take to have stuff go back to memory and stop using the swap space (outside of rebooting)?

theshadow27
Nov 2, 2010, 08:55 PM
I tried the program mentioned above (iFreeMem) and it seems to do exactly what it says. However, what was swapped out to HDD seems to stay there so I have 550mb in swap but 2 gb of Free memory. So what the heck does it take to have stuff go back to memory and stop using the swap space (outside of rebooting)?

You can't get stuff from swap back into main memory without knowing "what it is", and presumably when you'd like to do so the application that knew "what it was" has long been closed, or discarded the variable reference without releasing it's memory. By the time it has been written to disk, the garbage collector has already decided that it can't be automatically released. (italics to clarify mind-blowingly vague pronoun usage, not to represent sarcasm)

Since memory in this state has no active owner, and no way of identifying where it came from or how important it is, it's sort of sucked into a black hole with no way out.

The only way to convince the system that you're not using any of the memory in swap (and in RAM) is to restart launchd (PID 1) - after which any allocated memory *not* allocated by the new launchd (before daemons load) is clearly not being used by anything. The only way I know of to restart PID 1 is by rebooting the machine.

There's also a second launchd (started by the PID 1 launchd) created when a user logs in. Many user space applications (mostly .app's) are children of this process. Logging out will kill this process and free up any memory being used by those processes, but I don't know enough about the launchctl mechanism to say whether an all-user logout in multiuser mode followed by a login will blank-slate the memory manager like dropping a run level in regular *nix.

mattski.au
Jan 16, 2011, 11:17 PM
+1 that memory management could be better.

I work with audio and video programs and they definitely operate better with more free ram than inactive ram.

Currently I'm using a mac pro with 12gb ram and rendering some video with after effects. When free memory runs out, after effects rendering drops to 10% CPU usage as it spends all it's time waiting for pages to be swapped in and out of memory. With all my other apps quit, so there's free ram, the CPU usage is >400% and no surprises render times are about 40x faster.

Now, if I leave the computer to do nothing in my other apps, you would think they would eventually be paged to disk allowing after effects to run at it's full speed. This does not happen.

Perhaps it's the fault of the apps; perhaps it's the fault of the operating system. One thing is certain: having access to free ram allows programs to work faster than access to inactive ram.

On my home machine (with Xcode installed) I find that running 'purge' in a terminal window results in substantially better performance afterwards. This tool clears out inactive memory and effectively gives the memory system a full reset without having to reboot the whole computer.

Perhaps the purge tool should be a standard part of the os!?!

Chase R
Jan 17, 2011, 05:39 AM
I believe what is happening is that an app is chewing so much memory (this is the fault of the app developers), that it is paging out the memory that was once occupied by the system... Thus resulting in a slow laggy system when it has to page back in the memory from the HDD.

VLC does this with larger files (if you don't turn off "file memory mapping").

Vuze does this too... Horrible memory management.

I believe iVolume fixed this issue that it once had.

Transmission has become a little better with memory management, it is still catching quite a bit though.

theshadow27
Jan 17, 2011, 06:55 PM
On my home machine (with Xcode installed) I find that running 'purge' in a terminal window...

Holy crap - nice find! How did I miss that? :eek:

I vote purge the new bestest solution. *thumbsup*

cajaygle
Jun 22, 2011, 09:22 PM
> purge

BAM! Awesome! Thanks, mattski.au!

MrObvious
Oct 15, 2011, 06:49 AM
Open the Terminal App (comes with OSX)
Run "purge" from the command line


http://ayaz.wordpress.com/2011/04/13/getting-back-inactive-memory-on-mac/

rversteegh
Oct 20, 2011, 07:05 AM
I believe what is happening is that an app is chewing so much memory (this is the fault of the app developers), that it is paging out the memory that was once occupied by the system... Thus resulting in a slow laggy system when it has to page back in the memory from the HDD.

VLC does this with larger files (if you don't turn off "file memory mapping").

Vuze does this too... Horrible memory management.

I believe iVolume fixed this issue that it once had.

Transmission has become a little better with memory management, it is still catching quite a bit though.

Do you know if Plex has a similar effect to VLC in this regard? My 8gb ram i5 iMac frequently hits 40mb free ram with often up to 4-5gb in inactive. It gets very sluggish and is obviously having difficulty freeing up inactive ram however I am not sure what the root cause of this is.

http://www.icoretech.org/2011/07/how-to-recover-memory-on-mac-os-x-lion-for-free/

This suggests a way to auto purge after a preset amount of time, but it feels like a workaround for a problem that should perhaps not exist. Also watching movies with the 'purge' freeze every so often isn't a pleasant experience.

throttlemeister
Oct 20, 2011, 07:49 AM
Do you know if Plex has a similar effect to VLC in this regard? My 8gb ram i5 iMac frequently hits 40mb free ram with often up to 4-5gb in inactive. It gets very sluggish and is obviously having difficulty freeing up inactive ram however I am not sure what the root cause of this is.

http://www.icoretech.org/2011/07/how-to-recover-memory-on-mac-os-x-lion-for-free/

This suggests a way to auto purge after a preset amount of time, but it feels like a workaround for a problem that should perhaps not exist. Also watching movies with the 'purge' freeze every so often isn't a pleasant experience.
From my experience, Plex does like to use up every bit of available memory when watching a movie. It appears to fill memory as a buffer for playback. And it is rather slow to give it back, generally in excess of 15-30 minutes after you stop watching. Quitting plea generally releases the memory in about a minute. However, it does release it eventually.

tug
Oct 20, 2011, 08:46 AM
all ya got to do to get rid of inactive ram is install ifreemem, it closes inactive ram portion in memory and replaces it with free memory.

easy! :rolleyes:

Corrosive vinyl
Oct 20, 2011, 09:27 AM
go to the app store and download FreeMemory... a free app, which is ranked #7 in free apps.

I only use this when running huge RAM sucking games.

Chase R
Oct 27, 2011, 12:45 AM
Apple needs to make it easy for developers (heck, maybe they do) to disable apps from catching certain data. Yes, catching the program itself is very useful, but catching every bit of a 1080p movie is useless.

Transmission used to have this problem, but the devs figured out a fix for it. Vuze still catches every bit of data it reads and eventually turns your Mac into a turtle. VLC, Plex, and Handbrake seem to have the same issue as well.

flopticalcube
Oct 27, 2011, 12:46 AM
Apple needs to make it easy for developers (heck, maybe they do) to disable apps from catching certain data. Yes, catching the program itself is very useful, but catching every bit of a 1080p movie is useless.

Caching?

sammich
Oct 27, 2011, 12:51 AM
Transmission used to have this problem, but the devs figured out a fix for it. Vuze still catches every bit of data it reads and eventually turns your Mac into a turtle. VLC, Plex, and Handbrake seem to have the same issue as well.

I don't think you're quite explaining yourself right. If that were really the case, then I apparently have hundreds of GB of RAM.

Chase R
Oct 27, 2011, 12:52 AM
Caching?

:o

Thanks for catching my mistake. ;)

kemsiro
Nov 23, 2011, 11:21 PM
i take that as you have xcode installed.

go to terminal and purge

donutbagel
Sep 9, 2013, 09:55 PM
Honestly, you don't need to worry about the inactive RAM. OS X handles memory much better than Windows.

That's not saying much :p
Mac OS X makes mistakes sometimes. VMWare Fusion rarely causes my inactive RAM to take over the free RAM, and the computer lags like a dead whale until I purge in Terminal. Then it's fine. Inactive RAM otherwise works fine, but there's some issue with VMWare Fusion.

My friend actually ran into a rare case just now when he just had Safari and stuff open, and his inactive RAM was huge and slowing his computer down. It's OK now.

----------

I don't think this can be stressed enough. It is SUPPOSED to be that way. OS X does a very good job of managing memory to optimize performance.

It sometimes fails terribly under specific conditions. It's happened to me a few times. Inactive RAM taking up gigabytes, 10MB of free RAM, and the computer almost freezes up totally. That's not optimizing performance. Then I remove that optimization temporarily with purge, and it's 1000X more responsive.

----------


Isn't it more likely that

1) Parallels, in one or more specific configurations, has a serious issue with OSX memory management, and
2) Virtually every other OSX program does not?

Agreed, and throw in VMWare Fusion with that.