robbrazier

Purge Inactive Memory

29 posts in this topic

I made an alfred (v1) extension which I ported over to a workflow. It not only purges inactive memory, but also shows the amount purged, e.g. "1024 MB Purged". It's only requirement is python, which I'm pretty sure is pre-installed on macs, so there *should* be no issues in that respect.

 

Important Note - If this workflow is not working for you:

This workflow sometimes requires Xcode Command Line Tools to use the purge command. To download the tools, you can do one of the following (and only one as if you do more it can cause issues):

  1. Download Xcode from the Mac App Store and go to Preferences -> Downloads -> Components and download Command Line Tools
  2. Register for a free account at http://developer.apple.com and go to https://developer.apple.com/downloads/index.action, search for command line and download the latest version of  Command Line Tools for your version of OS X
  3. If you are running OS X Snow Leopard, you can either do 1 or download the command line tools from https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.6.pkg, as Apple does not provide a version of Command Line Tools for OS X 10.6 on developer.apple.com

You can download it at http://db.tt/mdQCdaT5
 
I would be really grateful for any feedback

purge_screenshot.png
purge_notification.png

Edited by robbrazier
thec13, arsenty, Southgirl and 2 others like this

Share this post


Link to post

*bump*

 

I have finally installed this workflow on my desktop that's running on Snow Leopard. Most of the times I get this:

 

rUGxwY5.png

 

while others I get "-1 MB purged." Any ideas if this a compatibility issue?

Share this post


Link to post

I am honestly not sure, could you type "python --version" into terminal and post the results, it may be a python version difference, as the workflow was made on mountain lion.

Share this post


Link to post

I am honestly not sure, could you type "python --version" into terminal and post the results, it may be a python version difference, as the workflow was made on mountain lion.

 

Python version's 2.6.1

Share this post


Link to post

Sorry, I'm not a python programmer by trade, so I'm pretty stumped by this. I will try a complete refactoring late tomorrow (I'm not at home atm, so can't really do much on it). Hopefully it will be working within the next couple of days if you can wait

Share this post


Link to post

Sorry, I'm not a python programmer by trade, so I'm pretty stumped by this. I will try a complete refactoring late tomorrow (I'm not at home atm, so can't really do much on it). Hopefully it will be working within the next couple of days if you can wait

 

Sure, I can wait. Thanks!

Share this post


Link to post

could you try opening terminal and typing "vm_stat", as this is the command used to find the inactive memory. I'm starting to wonder that it is not in snow leopard, and that is what is causing the problems

Share this post


Link to post

could you try opening terminal and typing "vm_stat", as this is the command used to find the inactive memory. I'm starting to wonder that it is not in snow leopard, and that is what is causing the problems

 

I went and typed what you asked for, and this info appeared:

 

Mach Virtual Memory Statistics: (page size of 4096 bytes)

Pages free:                           1951.

Pages active:                       444920.

Pages inactive:                     216685.

Pages speculative:                   20735.

Pages wired down:                   298320.

"Translation faults":            427055234.

Pages copy-on-write:              10410650.

Pages zero filled:               290062742.

Pages reactivated:                10168293.

Pageins:                          10613166.

Pageouts:                          3808810.

Object cache: 2149 hits of 951031 lookups (0% hit rate)

 

 

Does this help?

Edited by Southgirl

Share this post


Link to post

that's weird, it does work, so that isn't the problem. It looks exactly the same as mine, however I think I've figured out what it is.

 

Just doing some reading, it seems that Xcode command line tools may be needed for the "purge" command to function, so I think you'll need to install the command line tools (sorry).

 

As you are running Snow Leopard, there is no official direct download for the command line tools, and I don't particularly want to link you to an unofficial one which may not work (it's here anyway though if you want to try).

 

Depending on your version of Snow Leopard (if it has the Mac App Store or not), you could download it from there, or use the aforementioned link that I don't particularly want to recommend as I haven't tried it, and don't want to muck up your mac if it doesn't work :/

 

P.S. It appears that apple are actually using the installer linked above now as the official one (https://medium.com/kr-projects/6e54e8c50dc8 (scroll down to the heading "Apple's Interest"))

 

Apologies for the slight rambly nature as I have just been writing this and researching at the same time :P

Edited by robbrazier

Share this post


Link to post

I'll try to install this. I was reading on that page that Xcode needs to be uninstalled first. I just hope I don't screw anything up. :P

 

I'll let you know how goes!

Share this post


Link to post

I'll try to install this. I was reading on that page that Xcode needs to be uninstalled first. I just hope I don't screw anything up. :P

I'll let you know how goes!

Any further details on how the installation went? Did it work and does the workflow work now? :)

Share this post


Link to post

Any further details on how the installation went? Did it work and does the workflow work now? :)

 

Well, I finally got the time to get to this after a very hectic week at work. I followed the instructions posted here to uninstall Xcode, and got a "command not found" from Terminal. Not sure if it's safe to install the command line tools now.

 

And this is how far I went with this :(

Share this post


Link to post

ah, sorry to hear that :(

well, if it said "command not found", that shows Xcode isn't installed, so it should be safe to install the command line tools :) (from here [Option 1] rather than the link on that post)

Edited by robbrazier

Share this post


Link to post

okay, as a last try, can you try typing "purge" into terminal, just to confirm that it has been installed. If it does do something, then things have become quite confusing as it should work, however if it doesn't, things are also confusing, as it mustn't have installed the purge command when you installed the command line utilities :/

Share this post


Link to post

Does not work on Mavericks. Always comes back with 0MB purged. Is there a fix?

Ooh, I'm getting -1 MB Purged as well as 0, I'll try to figure out what's broken tomorrow

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now