Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I use mysql and it takes up to 2.5 GB of my ram. I checked activity monitor and saw that I have 1GB of inactive memory but it never changes even if I have only 10MB active free memory. Is there any way to force the inactive memory to be used?

share|improve this question
add comment

2 Answers 2

up vote 17 down vote accepted

You can think of inactive memory like free memory that's been reserved for a recently closed application, but will be used when 'true' free memory has been exhausted. If you have 1 GB of memory (for the sake of making this discussion easier) on a freshly booted system, imagine the OS uses 300 MB and you open an app that uses 200 MB. You now have a total of 500 MB used, and 500 free. If you close that app that was using 200 MB, the memory is marked inactive and you'll now have 300 used (OS), 200 inactive, and 500 free. If you open an app that requires 600 MB, it'll use the free memory then pull from the inactive pool.

You can free inactive memory by opening Terminal.app and typing (without the $):

 $ purge

You can, also configure MySQL to use more memory but if you're not having performance problems I'd leave everything alone:

For more information on inactive memory in OS X:

(The last link might require an Apple developer account)

share|improve this answer
    
Thanx for your answer but my problem is my system gets really slow but it doesn't use the inactive memory. –  AliBZ Mar 17 '11 at 19:31
    
I corrected myself, you can purge inactive memory (whoops!), see the updated reply. Also, it sounds like you have something else going on. Are you running any VMs? Lots of open applications? Are you sure it's a memory issue? Maybe CPU bottleneck? Disk I/O? –  Aaron Lake Mar 17 '11 at 19:47
    
I am running mysql with huge queries. I don't have any other large application running. –  AliBZ Mar 17 '11 at 20:12
    
@AliBZ: my system gets really slow but it doesn't use the inactive memory : System can be slow also because of CPU usage. Did you check this? –  Nivas Mar 18 '11 at 8:50
    
This is a very nice theoretical view of the system, which is exactly what Apple claims. But I have the same pb as the OP, and purge freezes my system for a few second and does ... nothing at all (at least with respect to the inactive memory pb). And yes, my system is swapping too even though I should have more than 1GB of RAM free. –  PierreBdR Mar 24 '12 at 15:07
show 17 more comments

To expand Aaron's answer:

Your case could be a problem with MySQL taking too much resources, but Inactive Memory is like Free Memory for the Operating System. The difference between Inactive and Free is that Inactive was recently used, so if you for example open iTunes and it uses 200MB, when you close it, the program gets closed, the memory of iTunes marked as Inactive but it remains like that unless its needed again. But if you happen to re-open iTunes, OS X knows that it's there already and inactive, so it marks it as active again and voilá, that was faster than having to reload it from the slower hard drive.

Provide more information about your computer to help find the cause of your "slow" system.

update: Here's more info about Memory and OS X (from Apple):

http://support.apple.com/kb/ht1342

share|improve this answer
    
for example I have this in my activity monitor : mysqld -> 2.2 GB oovoo -> 190 MB kernel -> 150 MB firefox -> 148 MB and other apps. I have 26MB free memory and 1GB inactive memory and my system is a little slow right now but my inactive memory does not change. –  AliBZ Mar 17 '11 at 20:32
    
@AliBZ: Is the "Swap outs" count in Activity Monitor climbing? That's the best indicator I know of that the system is really out of useable RAM (and having to swap memory contents out to disk to make room). Note that "Page ins" are not a useful indicator, as they'll climb every time a program is launched from disk (unless it happens to be already in inactive RAM). –  Gordon Davisson Mar 17 '11 at 23:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.